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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.