This is an issue that can occur if all co-ordinates are not integers; if you have, for example, fractional positions or not pixel perfect scaling, when choosing a colour to use for a pixel, it can be given a choice and may choose as you did not intend.