Benny K
Benny K

Reputation: 2087

Display image from S3 using python

I have to process very large images (size > 2 GB) stored in aws s3. Before processing I actually want to display some of them. Download time is infeasible, is it possible to display them without downloading using only Python?

Upvotes: 0

Views: 624

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269101

You could give a URL to the user to open in a web browser. This does involve downloading the image, but it would be done outside of Python.

If you want to present them with a "thumbnail", then you would need a method of converting the image. This could be done with an AWS Lambda function that:

  • Loads the image into memory (it's too big for the default disk space)
  • Resizes the image to a smaller size
  • Stores it in Amazon S3
  • Provides a URL to the smaller image

This is similar to Tutorial: Using AWS Lambda with Amazon S3 but it would need a tweak to manipulate the image in memory instead of downloading the image to the Lambda function's disk storage (that is limited to 512MB).

Upvotes: 2

Related Questions