Indexing a PIL image

孤者浪人 提交于 2019-12-01 17:35:50

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/44967819/indexing-a-pil-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!