Python PIL: RGB color index

after this link, I was able to download and read pixels from .gif. This question specifically sets the RGB value, but the accepted (and the most voted answer) that I used as a reference makes me get int as a value. What is it? I think some kind of index, but how to convert it to the correct rgb value? Thanks

[..]
img = Image.open(GIF_FILENAME)
pix = img.load()
for i in range(5):
    print img.getpixel((i, 0))
    # this returns me like 78, 65.. how to get RGB?
[..]
+3
source share
1 answer
img = Image.open(GIF_FILENAME)
rgbimg = img.convert('RGB')
for i in range(5):
    print rgbimg.getpixel((i, 0))
+5
source

Source: https://habr.com/ru/post/1735045/


All Articles