Search code examples
pythongoogle-app-enginewebapp2blobstore

Store resized image on blobstore webapp2


I have resized image successfully using GAE images api now i again want to store the resized image in blob-store how can i do it kindly help. Here is the code

img = images.Image(blob_key=user.profile_pic)
img.resize(width=80, height=100)
img.im_feeling_lucky()
thumbnail = img.execute_transforms(output_encoding=images.JPEG)

if i use this code it displays the resized image but i want to store it again in blob store.

self.response.headers['Content-Type'] = 'image/jpeg'
self.response.out.write(thumbnail)

Solution

  • Here is the solution after getting the serving url we can simply pass arguments in the link to perform operations on the image.

    img = images.Image(blob_key=user.profile_pic)
    url = images.get_serving_url(user.profile_pic)        
    url = url + "=s80" #if i want a thumbnail