如何保存存储在GAE Blobstore中的旋转图像?

时间:2016-01-06 12:30:06

标签: python google-app-engine

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

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

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

2 个答案:

答案 0 :(得分:1)

转换后的image只是一个字节集合,您可以将其写回云存储 - 作为新对象或覆盖现有对象(例如cloudstorage.open,模式设置为" w"使用Python GS Client。

答案 1 :(得分:1)

使用Files API, which is now deprecated写入blobstore。

您可以使用GCS代替写入图像(GCS is recommended over Blobstore无论如何)。

如果需要,您仍然可以保留the blobstore API with GCS。我认为应该可以为您的用户透明地混合使用blobstore和GCS,这样您就不必将所有现有映像从blobstore迁移到GCS。