【发布时间】:2015-08-01 08:06:14
【问题描述】:
我有一张使用 Django Forms 上传的图片,它在变量中可用 InMemoryFile 我想要做的是让它渐进。
使图像渐进式的代码
img = Image.open(source)
img.save(destination, "JPEG", quality=80, optimize=True, progressive=True)
Forms.py
>my_file = pic.pic_url.file
photo = uploader.upload_picture_to_album(title=title, file_obj=my_file)
问题是,我必须保存文件以防我想让它渐进式,然后再次打开它以将其发送到服务器。 (让它进步似乎是多余的动作)
我只是想知道是否有办法使图像渐进,它不会将图像物理保存在磁盘上而是在内存中,我可以使用现有代码上传它吗?
想法
寻找类似的东西。
my_file=pic.pic_url.file
progressive_file = (my_file)
photo = picasa_api.upload_picture_to_album(title=title, file_obj=progressive_file)
【问题讨论】:
标签: python django python-imaging-library pillow