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.
Writing to the blobstore used to be possible using the Files API, which is now deprecated.
You can use GCS instead for writing the image (GCS is recommended over Blobstore anyways).
You can still keep the blobstore API with GCS if you want. I think it should be possible to even mix blobstore and GCS transparently for your users so that you don't have to migrate all your existing images from the blobstore to GCS.
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).