# -*- coding: utf-8 -*- from PIL import Image im = Image.open(f'../file/python.png') print('图片大小:', im.size) print(im.getpixel((400, 88))) for i in range(175): # im = Image.open(f'../file/单个像素更改/python_更改单个像素颜色{i}.png') # 通过调用getpixel()方法 得到坐标(400, 88)处的 im.putpixel((i*2, i), (255, 255, 255)) # im.save(f'../file/单个像素更改/python_更改单个像素颜色{i+1}.png') im.save(f'../file/单个像素更改/python_更改单个像素颜色.png') for i in range(0, 466): for j in range(175, 176): im.putpixel((i, j), (255, 255, 255)) im.save(f'../file/单个像素更改/python_更改单个像素颜色2.png')
标签:读取,更改,py,像素,im,file,单个,255 From: https://www.cnblogs.com/zhaoyiguang/p/16697354.html