I am working on saving compressing and saving image on AWS server. Currently using PutObjectRequest of com.amazonaws.services.s3.model to save the image. I checked online and everywhere following code is used to save image on disk.
writer.write(null, new IIOImage(image, null, null), param);
I am confused on how to compress it first and then send the inputstream to save in the server. how do i compress the image in rest API and save it in AWS server?
Instead of a synchronous flow in your code where you do the compression before upload, you can follow the following approach.
This approach is highly scalable and a pattern used for creating thumbnails of the images & etc. (You should be able to find a Lambda template for Thumbnail creation which you can modify for this)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.