print ("loading object", input_bucket, input_key)
response = s3client.get_object(Bucket=input_bucket, Key=input_key)
print("s3 get object response", response)
body = response['Body']
image = Image.open(body)
print ("generating thumbnail", output_width, output_height)
thumbnail = resizeimage.resize_thumbnail(
image, [output_width, output_height])
body.close()
print ("saving thumbnail", output_format)
with io.BytesIO() as output:
thumbnail.save(output, output_format)
print ("uploading thumbnail", output_bucket, output_key)
output.seek(0)
s3client.put_object(Bucket=output_bucket, Key=output_key,
Body=output, ContentType=output_content_type)