[Image-SIG] Re: colorshift while converting png to gif
Bill Janssen
janssen at parc.com
Wed Feb 9 22:09:31 CET 2005
Aahhhh! Thanks so much -- I too was wondering what was going on, and
hadn't pinned the problem down. I hope that patch will be in a future
release.
Bill
> Jeff Epler wrote:
>
> > I get a similar problem with the following complete program:
> >
> > import Image
> > i = Image.fromstring("RGB", (1, 1), chr(255) * 3)
> > j = i.convert("P")
> > print j.getpixel((0,0)) # prints 252, should print 255
> >
> > This seems to have something to do with converting to a palette image.
>
> you really mean
>
> print j.convert("RGB").getpixel((0,0)) # prints (252, 252, 252), should print (255, 255, 255)
>
> here -- but the fact that you did get index 252 was just what I needed to realize
> what the problem was (the target palette contains a 6x6x6 color cube, but also a
> couple of grayscale values, and the palette matching algorithm considers 252 to
> be "close enough", despite the fact that the palette contains better matches). the
> attached patch fixes the problem.
More information about the Image-SIG
mailing list