【发布时间】:2014-04-28 18:01:11
【问题描述】:
在我的 django 项目中,我有一个 inmemoryuploadedfile,然后我用 Pillow 打开它,旋转它,然后将其保存回自身。然而,最后一步实际上不起作用。当我将其保存到文件时,正确(旋转)图像被保存。如何保存回文件对象而不是实际文件?
image = request.FILES['file']
img = Image.open(image)
img = img.rotate(90)
img.save("sample.jpeg", "jpeg") #this is correct
img.save(image, "jpeg") #this does not change the actual in memory image
【问题讨论】:
标签: python django python-2.7 python-imaging-library pillow