In the past I've found this to be an issue with PNGs on Mac. The PNG
specification apparently allows for color correction on image load, based
on your display settings, which means it's going to be very inconsistent
between platforms (although it should look more consistent to the eye). If
you require pixel values to be exact, I recommend trying BMP instead and
seeing if you still see the issue.

On Sun, Nov 5, 2017 at 2:45 PM dejohnso <dejoh...@cs.utah.edu> 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

Reply via email to