python获取图片中某个像素的坐标
from PIL import Image
img = Image.open('zhaose.png')
pixels = img.load()
width, height = img.size
for x in range(width):
for y in range(height):
r, g, b = pixels[x, y]
# in case your image has an alpha channel
# r, g, b, a = pixels[x, y]
if(r==218 and g==196 and b==153):
print(x, y, f"#{r:02x}{g:02x}{b:02x}")
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/280776.html