Unable to Surface.convert(32) some 1-bit images.

Issue #131 open
Dean Serenevy
created an issue

I am having a problem with convert(32) where some png images can fail to load. I am encountering this with 1-bit pngs where both colors in the color palette are black (this is the only significant difference I can detect between the two attached images).

{{{ Python 2.7.3rc2 (default, Apr 22 2012, 22:35:38) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import pygame pygame.version '1.9.1release' im = pygame.image.load("city.png") im.get_palette() ((0, 0, 0, 255), (255, 255, 255, 255)) im2 = pygame.image.load("brick.png") im2.get_palette() ((0, 0, 0, 255), (0, 0, 0, 255)) pygame.display.init() pygame.display.set_mode((640,480)) <Surface(640x480x32 SW)> im.convert(32) <Surface(24x24x32 SW)> im2.convert(32) Traceback (most recent call last): File "<stdin>", line 1, in <module> pygame.error: Empty destination palette }}}

Also reported at Kivy bug 516: https://github.com/kivy/kivy/issues/516

Comments (4)

  1. René Dudfield
    • changed status to open

    Thanks for the detailed bug report!

    A workaround might be to blit the surface to another surface first... and see if that helps.

    Next step, I need to convert the test you have there into a unit test. If you have some spare time to do that, it would be very helpful for fixing the bug.

  2. Log in to comment