版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
这个编译器真是相见恨晚啊啊啊啊啊
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_width=int(width/3)	box_list=[]	count=0	for j in range(0,3):	for i in range(0,3):	count+=1	box=(i*item_width,j*item_width,(i+1)*item_width,(j+1)*item_width)	box_list.append(box)	print(count)	image_list=[image.crop(box) for box in box_list]	ret