1、用PIL将png转为jpg时出错:
raise IOError("cannot write mode %s as JPEG" % im.mode)
IOError: cannot write mode P as JPEG
from PIL import Image
img = Image.open("1.png")
加一句:img = img.convert('RGB')
img.save('1.jpg')
2、Resize图片
img = Image.open("1.jpg")
ResizedImg = img.resize((256,256))
ResizedImg.save("1.jpg")