python Pillow crop 裁剪照片

2021-06-09  本文已影响0人  虚心的锄头

原图


ico.png
from PIL import Image
import os
filename = ''
iconame = os.path.join(filename, 'ico.png')
img = Image.open(iconame)
_width, _height = img.size 
crop = (55, 0, _width, _height)
cropped = img.crop(crop)  # (left, upper, right, lower)
cropped.save('new_ico.png')

结果


new_ico.png
上一篇 下一篇

猜你喜欢

热点阅读