参考:
用python发一张高逼格朋友圈
附:python3.6.4+sublime Text安装及配置
点击打开链接
这个编译器真是相见恨晚啊啊啊啊啊
from PIL import Image
import sys
def fill_image(image):
width,height=image.size
print(width,height)
new_image_length=width if width>height else height
print(new_image_length)
#new_image = Image.new(image.mode, (new_image_length, new_image_length), color='white')
new_image=Image.new(image.mode,(new_image_length,new_image_length),color='white')
if width>height:
new_image.paste(image,(0,int((new_image_length-height)/2)))
else:
new_image.paste(image,(int((new_image_length-width)/2),0))
return new_image
def cut_image(image):
width,height=image.size
item_wi