如何保存存储在GAE Blobstore中的旋转图像? [英] How to save a rotated image which was stored in GAE Blobstore?

查看:99
本文介绍了如何保存存储在GAE Blobstore中的旋转图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想旋转并保存已存储在Blobstore中的图像。为此,我尝试使用 images.Image.rotate 方法

$ p $ img = images.Image(blob_key = image.blob)
img.rotate(180)
final_image = img.execute_transforms(output_encoding = images.PNG)

我不知道如何将旋转后的图像再次保存到Blobstore中。

解决方案

转换后的 image 只是您可以写回到Cloud Storage的字节集合 - 作为新对象或覆盖现有对象(例如 cloudstorage.open 使用Python GS Client将模式设置为w)。


I want to rotate and save an image which was already stored in blobstore. For this I tried using images.Image.rotate method

img = images.Image(blob_key=image.blob)
img.rotate(180)
final_image = img.execute_transforms(output_encoding=images.PNG)

I don't know how to save the rotated image again to the blobstore.

解决方案

A transformed image is just a collection of bytes that you can write back to the Cloud Storage - as a new object or overwrite an existing one (e.g. cloudstorage.open with mode set to "w" using Python GS Client).

这篇关于如何保存存储在GAE Blobstore中的旋转图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆