Closed GoogleCodeExporter closed 9 years ago
You can use the OS decoder (not using pypng):
$ python
Python 2.7.3 (default, Jul 24 2012, 10:05:39)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyglet
>>> pyglet.image.load("Scorpion_scorpio_robot_with.png")
<ImageData 16x16>
>>> pyglet.version
'1.2alpha1'
>>>
Doc says: "This use is not recommended unless your application has to work
around specific deficiences in an operating system decoder".
That said... yes, I think we should support palettes or at least write a note
in the docs saying we don't support them :)
Original comment by useboxnet
on 21 Jul 2013 at 9:41
I've added palette support to pypng:
http://code.google.com/p/pyglet/source/detail?r=fbc3d38787c66063ca76e84efb189065
30dc2d61
It has some limitations though: doesn't support transparent colour and the
image is converted from indexed to RGB. Write is not supported.
Also I'm not sure the background colour implementation is 100% correct, I can't
find a way to test it.
Can you give it a go?
Original comment by useboxnet
on 21 Jul 2013 at 11:22
Original comment by useboxnet
on 21 Jul 2013 at 11:23
OK, it turns out it wasn't that difficult. I've added transparent support too:
http://code.google.com/p/pyglet/source/detail?r=b210ac020f016fc178de641cdbe8508f
cb426fc0
Still... if you need transparent colours is easier to convert to RGBA ;)
So now the indexed image is converted to RGB or RGBA if there's a transparent
colour. No write support.
That should do it!
Original comment by useboxnet
on 21 Jul 2013 at 1:20
Original issue reported on code.google.com by
hills....@gmail.com
on 19 Jun 2013 at 2:32Attachments: