RGB

PIL: Get RGB Value from GIF

If you load a GIF file with PIL via Image.open(‘giffile.gif’) and then try to look at its pixels, you would get integers instead of tuples since the GIF pixels refers to one of the 256 colours in the GIF colour palette. The palette would then contain the RGB value of the pixel.

To avoid all this hassle and just get RGB tuple directly:

gif = Image.open('giffile.gif')
rgbimage = GIF.convert ('RGB')
rgbimage.getpixel((0,0))
>>>(231, 10, 54)
 Scroll to top