Ok, I think I understand your problem and you have a few options that I can think of, the best I don't want to write the code for, but I will give a metaphor for the algorithm I am suggesting. imagine your map as colored entirely black and white, where black pixels are not allowed to be collided with and white pixels are. then imagine your hero (or any character) to be a shape cut out of that map. if any of the pixels in the shape are black, then you have collision. this is similar to what the folks above were suggesting but it does not assume that your character moves on a grid (well it does, but not the same way). some things that might help you speed this up. if your character moves one pixel at a time, then you only need to check the boundary of the shape for black pixels, if he moves two pixels at a time, you need to check two pixels in etc. and if you imagine this as boolean trues and falses instead of black and white, then collision is just everything in your test space ORed together. what's nice about this method, is that since you're only testing the boundary, you can make your collision resolution really fine and the amount of checks you have to do goes up as the square root of the number of pixels, which increases pretty slowly. Some ideas for optimization are to only check a small subset of the pixels in the border of your character since this check is going to occur very often, and this is a good approximation of the whole border.
another idea, you can actually do this by drawing, and then converting the color data into boolean data.
hope this helps.