Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indexing a PIL image

Is PIL's image coordinate indexing reversed? Is it indexed as image[column, row]?

I have an image which I open using PIL (pillow)

img = Image.open('picture.png').load()

and when I try to print the pixel value of the first row, second column

print(img[0,1])

I get the pixel value of the 2nd row's first column

Can anyone clear this out?

like image 815
Anjali Avatar asked Jul 07 '17 09:07

Anjali


People also ask

What is a image index?

The image index is a higher-level manifest which points to specific image manifests, ideal for one or more platforms. While the use of an image index is OPTIONAL for image providers, image consumers SHOULD be prepared to process them.

What is PIL image image?

Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. It is available for Windows, Mac OS X and Linux. The latest version of PIL is 1.1.


1 Answers

PIL indexes images in Cartesian co-ordinates. So it is indexed as img[col, row].

like image 109
Anjali Avatar answered Oct 11 '22 15:10

Anjali