My Current flow that I am following for image upload
and its manipulation
on the S3 bucket is as follows:
- Image is uploaded into an S3 Bucket.
- Retrieving the image buffer of the saved image in the S3 Bucket.
- Resizing of the image buffer using gm and imagemagick npm module.
- Saving the resized image buffer with the original extension as a new image in the S3 Bucket.
As the image size
increases so those the API response
time.It takes 3 secs for the API to give a response while following above workflow for a 300 KB image and 30 secs for a 15 MB or more image.
I don't know if my flow is correct or not. My requirement is that I need to reduce my API response time while uploading a 15 or more MB image. Can somebody suggest me how to achieve this?
EDIT
To make it clear I am uploading a single 15 MB file which I am sending it from Advanced Rest Client
(a chrome plugin) to my API. The image file is currently present in my local system. I am currently working on jpg
and png
images. I want to resize the image to both bigger and smaller sizes by reducing the width to height ratio. The API that I Have written is in Node JS which follows the above workflow.