【发布时间】:2020-04-07 13:39:02
【问题描述】:
我将图像从 PIL 存储到 StringIO。当我将它从 stringIO 存储到文件时,它不会生成原始图像。
代码:
from PIL import Image
from cStringIO import StringIO
buff=StringIO()
img = Image.open("test.jpg")
img.save(buff,format='JPEG')
#img=img.crop((1,1,100,100))
buff.seek(0)
#Produces a distorted image
with open("vv.jpg", "w") as handle:
handle.write(buff.read())
原图如下
输出图片如下
上面的代码有什么问题
【问题讨论】:
标签: python python-imaging-library stringio