0

Pygame.Surface.get_at() seems not to work properly and I cannot find a fix:

I draw 2 fully transparent PNGs filled with RGBA (0,0,0,0) using paint.net. One of them size (100 x 100), the other (1000 x 1000). If I load these with pygame and get the colour of the topleft pixel, the bigger one returns solid black, the other works fine:

source = pygame.image.load(os.path.join(os.getcwd(), imagename))
source.convert_alpha()
py_colour = source.get_at((0, 0))
print py_colour

bigger one -> (0, 0, 0, 255)
smaller_one -> (0, 0, 0, 0)

When blitting them, they both work fine though (they're fully transparent).

Why is this and how can I get the true colour?

Don Polettone
  • 185
  • 1
  • 14
  • maybe you have small black point at `(0,0)`. Did you check it with other tool ? – furas Jan 08 '17 at 22:01
  • thanks a lot for answering. No, that is definately not the case. I create the 2 images with paint.NET, both fully transparent and both the same format PNG (auto-recognition) – Don Polettone Jan 10 '17 at 19:31
  • I did some more tests using PIL and / or a different paint program. It seems that it only affects images bigger than 255 x 255 px ! That's weird! – Don Polettone Jan 10 '17 at 20:59
  • ...and only those drawn with paint.net. GIMP works fine. so it's actually paint.net that causes the issue when saving images bigger 255x255? – Don Polettone Jan 10 '17 at 21:39

0 Answers0