adieuadieu / retinal

🏙 Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to reduce the file size for a PNG file without actually resizing the image and not reducing the quality significantly ?

mandeepm91 opened this issue · comments

I am pushing pictures taken by webcam to s3 bucket and want to process those or rather optimize those images so that their file size reduces but there is not much loss of quality and resolution. Is it possible to accomplish the same with this utility ?

Hi @mandeepm91 — Hm.. Sharp does have some parameters for controlling the quality of the output image, and also by default omits metadata (e.g. EXIF data) when writing a new image file, but I'm not sure this would cover what you're looking for.

However, incorporating such a feature into this project makes a lot of sense. Perhaps enabling the use of a tool like imagemin would be useful?

Hi @adieuadieu,
For now we switched to JPEGs because that solved our purpose but I think adding this feature might be useful. I can try implementing this in a few days using imagemin. Let me know if I can proceed.

@mandeepm91 Yes I'd welcome a PR. I haven't thought too much about how it would be best to implement the imagemin support. Perhaps extending the "outputs" support currently used for calling Sharp functions, but add a special-case "imagemin" item which must come after all other output instructions.

Would be ideal if imagemin supported accepting a buffer. I haven't looked into this.