Python and PIL pixel values different for GIF and JPEG?

GIFs are pallettized, whereas JPEGs are RGB. The act of transforming the image disposes of the palette, so you will have to look through the pallette entries in the GIF to find the closest match to the desired color.

Up vote 0 down vote favorite share g+ share fb share tw.

I have a question about the pixel values returned from an image opened with PIL load function. I am using the following code: frame = Image. Open(fname).load() a = frame10, 10 If I load a GIF image, a is the integer value 43.

But if I convert the image a JPEG and rerun the code, a is a tuple (253, 254, 100). Why? And how can I convert (253, 254, 100) back to 43?

Thanks. Python pil gif jpg link|improve this question edited Apr 27 '11 at 6:23Blair2,171317 asked Apr 27 '11 at 5:58alex31.

To further clarify: a GIF image has a table of (up to) 256 colours. Each pixel has an index into this table (in your example, 10) which is used to determine its colour. JPEGs store the RGB values for each pixel.

If you look at entry 10 in the GIF's colour table, it should be (253, 254, 100) (or very close to it). – Blair Apr 27 '11 at 6:22.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions