Good day.

As the title sais, i am trying to extract pixel colors from images, in Python 3.

I know that for python 2.x, PIL (Python image library) can do that, via Image > getpixel((x,y)). It returns the colors as a list with 3 parameters, Red, Green and Blue. This is exactly what i want.
Now, the problem is that PIL doesn't work in Python 3.

Can anyone suggest how to do that ?
The bigger problem is that i need to extract pixel colors for many types of images : JPEG, PNG, BMP, GIF. For this, i might need different codecs... I am not good at image formats and codecs.

I just want to know if i can do this in the simple way, or i have to beg PIL to implement support for Python 3...

Thank you in advance.

8 Years
Discussion Span
Last Post by vegaseat

For right now the easiest way for you would be to study up on the bitmap file format, it is the simplest and most straight foreward format:

Read the file in as binary, and using the offsets listed get past the header to the pixel portion of the file data. Remember the pixel data starts at the bottom left of the image and goes left to right row by row up. You can always use one of the many image file converters to create .bmp files from .jpg files and so on.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.