I want to use the google.appengine.api images package but I do not know how to install the tools for virtualenv. The package works fine when I use dev_appserver.py on my normal environment but when I use the flexible environment with flask it cannot find the package. Is there a way to add the images library into my virtualenv?
When I try using Pillow to resize the image before I uploaded it to the server but when I would do that the image would arrive in the cloud storage at 0B.
if file and allowed_file(file.filename):
filename = '%s_%s.jpg' % (item.id, len(item.photos))
# Resize file using pillow
image = Image.open(file)
image.thumbnail((300,300)
resized_image = io.BytesIO()
image.save(resized_image, format='JPEG')
# if I did a image.show() here the image would
# properly be shown resized
gcs = storage.Client()
bucket = gcs.get_bucket(CLOUD_STORAGE_BUCKET)
blob = bucket.blob(filename)
blob.upload_from_file(resized_image,
content_type=file.content_type)
# I would then view the image in the bucket and it shows up as 0 bytes
# and blank
# If I just use the regular file it uploads fine.