On 05.11.2017 20:37, dejohnso wrote:
Hi,
I am loading a background map and blitting it to the screen. Once I have done
this, I am getting color values under the mouse cursor.
However, I am seeing small color shifts between the image and the blitted
image. For example,
from the screen with the background image: (103, 255, 103, 255)
directly from the image: (102, 255, 102, 255)
This is also inconsistent. Sometimes, the colors are the same - even for the
color shown above - so sometimes it gets shifted and sometimes not.
Does anyone know why this is happening? The inconsistency is particularly
strange to me, as it implies the same start color is inconsistently blitted to
the screen.
I am also seeing an overall color shift. The colors I am displaying from the
screen or image are off by a few percent compared to the colors I see using a
color picker in an image editing program.
The relevant code is
map = pygame.image.load("AvoiderMap.png")
...
while is_alive:
# Check events by looping over the list of events
for event in pygame.event.get():
….
screen.blit(map, map_rect)
pos = pygame.mouse.get_pos()
cursor_color = screen.get_at(pos)
img_color = map.get_at(pos)
print(cursor_color, img_color)
Thanks,
David
Hi
I vaguely remember something about png having gamma correction applied
automatically when loading it, but I can't find anything about this in
the docs. Try BMP, this should be unchanged.
~DR0ID