Mr Snidesmin #1 yep, that wasn't the problem - I was using (or thought I was) 32-bit color all the time and I should have had 256*256*256 possible values (red*green*blue). But for some reason when reading the pixel values I sometimes got small errors.