Image processing — reduce image size
I am developer who got the task to create a service which is used to reduce the size of image.
After surfing, I found sharp js. A npm lib to do image processing.
First try implementing it but the code does not have much effect on image.
I try to find what online tools do
- checked for png image (check the format of image changes to palette from rgb alpha) — used inside in the image
and what photoshop do
- found that converting the image to jpeg reduces size
After few discussion with collegues decided to follow below things:
1. Convert the image to jpeg image.
2. Decrease the image quality to 25%.
3. Used mozjpeg a property of jpeg image which reduces the image size.
4. Prevent chromaSubsampling as it affects the text in the image.