Python and PIL pixel values ​​differ for GIF and JPEG

I have a question about pixel values ​​returned from an image opened using the PIL upload function. I am using the following code:

frame = Image.open(fname).load() a = frame[10, 10] 

If I upload a GIF image, a is an integer value of 43. But if I convert the image to JPEG and re-run the code, a is a tuple (253, 254, 100) .

What for? And how can I convert (253, 254, 100) back to 43?

+7
python gif jpeg python-imaging-library
Apr 27 2018-11-11T00:
source share
1 answer

GIF palettes, and JPEG - RGB. The image conversion act has a palette, so you will need to look at the palette entries in GIF to find the closest match to the desired color.

+8
Apr 27 '11 at 6:01
source share



All Articles