h2non / imaginary

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing
https://fly.io/docs/app-guides/run-a-global-image-service/
MIT License
5.5k stars 455 forks source link

exposed palette from GET endpoints #380

Closed vaibsharma closed 2 years ago

vaibsharma commented 2 years ago

Hey @h2non,

Hope you're well. In reference to this issue https://github.com/h2non/imaginary/issues/378. Can you please have a look at this PR. This enable palette for all the APIs that requires to save the image in PNG.

Without Palette - https://aqueous-reef-74512.herokuapp.com/resize?width=200&height=200&url=https://raw.githubusercontent.com/h2non/imaginary/master/testdata/large.jpg&type=png (Image size - 39KB)

After Palette - https://aqueous-reef-74512.herokuapp.com/resize?width=200&height=200&url=https://raw.githubusercontent.com/h2non/imaginary/master/testdata/large.jpg&type=png&palette=true (Image size - 19KB)

Let me know if there are more changes needed here.

Thanks& Regards, Vaibhav

vaibsharma commented 2 years ago

I also checked this @h2non https://github.com/libvips/libvips/blob/v8.12.2/libvips/foreign/pngsave.c#L548

Is it a good idea to add Quality param in bimg here https://github.com/h2non/bimg/blob/master/vips.h#L333? The default value is 100. Getting some really good results even with 50 quality and definitely smaller image size.

Played with effort param as well with palette enabled. It is easy to tune CPU usage while processing the images. Might help a few others like me :)

Would love to get your feedback.

h2non commented 2 years ago

LGTM, thanks!

h2non commented 2 years ago

Would you like to support effort param for AVIF encoding? Here the bimg field.

h2non commented 2 years ago

Is it a good idea to add Quality param in bimg here https://github.com/h2non/bimg/blob/master/vips.h#L333?

Quality param is already supported and it is used in different image formats at processing time. If you detect any issue with that, please report it and provide further details.

vaibsharma commented 2 years ago

Hey @h2non

Would you like to support effort param for AVIF encoding? [Here the bimg field](https://github.com/h2non/bimg/blob/master/options.go#L229-L230).

Yeah sure @h2non. Should I submit separate PR for this?

Thanks

h2non commented 2 years ago

Yeah sure @h2non. Should I submit separate PR for this?

Sounds good, I can merge and close this one.