Compression of generated images via remote service
Hello, I would like to employ some badass compressing service like tinyPng or tinyJpg, they have API so that should be easy. I'm interested to compare results with built in image processor.
Anyhow. I'm looking for a way where I can hijack the end of "thumbnail" creating process and on top of cropping etc perform a compression on the image.
but if you want to try your own thing, then there is a PostProcessor Event that ImageProcessor fires for a request, which you could handle and then provider further optimisations:
and I realized the postprocessor is kinda not useful, truthe is I was runing it with quality set to 65, and lower the quality lesser the effectiveness of additional compression. The difference with and without postprocessor was 2% on 65 quality output from imageprocessor.
Than I integrated Tinify nuget package and I got better results
65 quality 15% difference in size
95 quality 36% difference in size
85 quality 20% difference in size
So I went with 85 quality for visible thumbnails and 95 for a lightboxed images including the Tinify pipeline..
It will take some time initially, but it will get cached by CDN, so that's totally okay..
Compression of generated images via remote service
Hello, I would like to employ some badass compressing service like tinyPng or tinyJpg, they have API so that should be easy. I'm interested to compare results with built in image processor.
Anyhow. I'm looking for a way where I can hijack the end of "thumbnail" creating process and on top of cropping etc perform a compression on the image.
Does anyone knows how can I do that?
Cheers, Vojta
Hi Vojtech
Have you looked at the ImageProcessor post processor dll?
https://imageprocessor.org/imageprocessor-web/plugins/postprocessor/
you drop it into your site and it uses
gifsicle : http://www.lcdf.org/gifsicle/ truepng : http://x128.ho.ua/pngutils.html pngquant : https://pngquant.org/ jpegtran : http://jpegclub.org/ mozjpeg : https://github.com/mozilla/mozjpeg
to provide further optimisations...
but if you want to try your own thing, then there is a PostProcessor Event that ImageProcessor fires for a request, which you could handle and then provider further optimisations:
https://github.com/JimBobSquarePants/ImageProcessor/blob/1c65565c7f42fa5e9917fbe408d7df3827c607bb/src/ImageProcessor.Web.Plugins.PostProcessor/PostProcessorApplicationEvents.cs
regards
Marc
I run an experiment,
and I realized the postprocessor is kinda not useful, truthe is I was runing it with quality set to 65, and lower the quality lesser the effectiveness of additional compression. The difference with and without postprocessor was 2% on 65 quality output from imageprocessor.
Than I integrated Tinify nuget package and I got better results
65 quality 15% difference in size
95 quality 36% difference in size
85 quality 20% difference in size
So I went with 85 quality for visible thumbnails and 95 for a lightboxed images including the Tinify pipeline..
It will take some time initially, but it will get cached by CDN, so that's totally okay..
is working on a reply...