I am building a mobile app similar to Instagram in terms of working with Images. I am using amazon s3 to store the images and Mysql for the file path. I'm trying to ensure users upload great quality pictures but also ensure the file size is reasonable, Should I compress the images? Does anyone have an idea and what is the acceptable size for an image?
CodePudding user response:
The definition of "acceptable" is totally up to you!
You should certainly store a high-quality image (probably at the original resolution), but you would also want to have smaller images for thumbnails and web/app viewing. This will make it faster to serve images and will reduce bandwidth costs.
A common technique is to have Amazon S3 trigger an AWS Lambda function when a new image is uploaded. The Lambda function can then resize the image into multiple sizes. Later, when your app wishes to retrieve an image, it can point to a resized image rather than the original.
When resizing images, you can also consider image quality. This allows JPG files to reduce in size without needing to reduce in resolution.