[Tilecache] Meta Tiled paletted images - PIL issue

Ivan Mincik ivan.mincik at gista.sk
Mon Oct 19 06:47:01 EDT 2009


I was looking for the reason, why we get corrupted image using
Tilecache meta tiling with paletted images. (QUANTIZE_FORCE=ON,
QUANTIZE_DITHER=OFF, QUANTIZE_COLORS=256 in UMN Mapserver).

For others experiencing this problem I would like to note, that it
could be a PIL issue in processing paletted images.
I have tried following simple code (just opening and saving the image):

#!/usr/bin/python
import Image

im = Image.open('test.png')
print 'Image mode: ', im.mode
print 'Info: ', im.info
im.save('out.png', transparency=0)

Output image is different than the original image. Why ? PIL seams to
be loosing transparency value which is different for each color in PNG
image.
For example: 'test.png' is containing color 111 111 111 44 in palette.
After opening and saving in PIL we get 111 111 111 255.
I was trying also to extract palette from original image by using
getpalette() function and put it back with putpalette(), but the
result was the same.

So, I think, we can not use meta tiling in paletted images because of
PIL limits.

For anybody wanting to look at this problem, You can download my test
image here:
http://gista.sk/dl/test.png

Ivan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.osgeo.org/pipermail/tilecache/attachments/20091019/3ff6d942/attachment.bin


More information about the Tilecache mailing list