Thanks a lot for the respond. However I already knew that. I think I need to explain a little better. What I want to do is the same as what game-maker does. I want to first analyze the image to find its maskcolor, and then load it - again. In this way I don’t always have to set the maskcolor, it will automatically be read (maskcolors can be tricky, and require a lot of trial and error).
Maybe the problem is reading a pixel value after the image has been masked. It seems that the first time it reads the pixel its fine, and sets that maskcolor to the color of this pixel. The next time the image is already masked so it just reads r=0, g=0 and b=0. As this new value is now set to a maskcolor it can now read the pixel again. So it works every other time.
Moral of the story: You cant read a masked pixel!... I guess
Maybe the problem is reading a pixel value after the image has been masked. It seems that the first time it reads the pixel its fine, and sets that maskcolor to the color of this pixel. The next time the image is already masked so it just reads r=0, g=0 and b=0. As this new value is now set to a maskcolor it can now read the pixel again. So it works every other time.
Moral of the story: You cant read a masked pixel!... I guess