Tag Archives: image

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)

PyQt Drag Images into List Widget for Thumbnail List

This simple tutorial shows how you can create a program with Python and Qt to allow for image files from Explorer/Finder/Nautilus to be dropped in a list widget and create list items with thumbnails

droppedthumbnails

First we subclass a QListWidget to handle events
Continue reading