[Tilecache] Meta Tiled paletted images - PIL issue
Ivan Mincik
ivan.mincik at gista.sk
Fri Oct 23 11:46:49 EDT 2009
On Friday 23 October 2009, you wrote:
> I don't think many programs/libraries work with paletted transparency in
> PNGs. Nor does PIL. So I'm just writing to confirm that this is a missing
> feature of PIL.
> Tibor
No solution found also after writing to PIL mailing list, so we can not use nice optimized images produced by UMN Mapserver.
We decided to produce RGBA images from Mapserver and write a "patch" to Tilecache to optimize images just after creation using external tools like pngnq of optipng.
Ivan
>
> On Mon, Oct 19, 2009 at 8:14 PM, Ivan Mincik <ivan.mincik at gista.sk> wrote:
>
> > On Mon, Oct 19, 2009 at 2:56 PM, Travis Kirstine
> > <traviskirstine at gmail.com> wrote:
> > > You can try getting the transparency value from the im.info dictionary
> > >
> > > im.save('out.png', 'PNG', transparency=im.info['transparency'])
> >
> > Thanks for reply, but this is what I have already tried. 'im.info' is
> > containing just this: {'transparency': 0, 'Software': 'UMN
> > Mapserver'}.
> > I need transparency value for every palette color.
> >
> > >
> > > Regards
> > >
> > > 2009/10/19 Ivan Mincik <ivan.mincik at gista.sk>:
> > >>
> > >> 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
> > >>
> > >>
> > >> _______________________________________________
> > >> Tilecache mailing list
> > >> Tilecache at openlayers.org
> > >> http://openlayers.org/mailman/listinfo/tilecache
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > Travis K.
> > >
> > > Toronto, Canada
> > > ------------------------------------------------------------
> > > "She knows there's no success like failure
> > > and that failure's no success at all."
> > > -Bob Dylan-
> > > ------------------------------------------------------------
> > >
> > _______________________________________________
> > Tilecache mailing list
> > Tilecache at openlayers.org
> > http://openlayers.org/mailman/listinfo/tilecache
> >
>
--
Ivan Mincik
Gista s.r.o.
-------------- 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/20091023/d7d5459a/attachment.bin
More information about the Tilecache
mailing list