scour-project / scour

Scour - An SVG Optimizer / Cleaner
Apache License 2.0
760 stars 61 forks source link

add PNG compression #237

Open JoKalliauer opened 4 years ago

JoKalliauer commented 4 years ago

Add png-optimization

Input=Output (573KB)

LargePngEmbeddedSCs.svg.txt BAG_Plakat_CoVi_QR_Abstand_A3_297x420_d_Inkpss692s svg

Expected Output (196KB)

small.svg.txt BAG_Plakat_CoVi_QR_Abstand_A3_297x420_d_Inkpss svg

Ede123 commented 4 years ago

Might be a nice addition in principle, but

Personally I'd go for something similar to zopflipng with which I've made good experiences in the past, but obviously that would need us to call out to an executable.

JoKalliauer commented 4 years ago

I assume it is out of scope, I did not expect that it will considered for implementing (optimiziation needs prozessing-time and as said it is a SVG optimizer not a PNG optimizer)

In lager images often Rasterimages take most of the space. For such svg classical svg optimization is useless, but png optimization is essential, therefore large file-reduction, no svg-breaking and only needs prozessing-time if image are embedded.

SVGs render require rendering PNGs and JPEGs, see https://github.com/RazrFalcon/resvg/issues/214#issuecomment-589828455 maybe also https://www.w3.org/Graphics/SVG/About.html

lossless JPEGcompression is imho minimal, lossy compression might be undesired.

PNGoptimization Benchmark: https://css-ig.net/png-tools-overview GitHub: https://github.com/topics/png-compression Python: https://cloudinary.com/blog/image_optimization_in_python

Python modules to do PNG optimization feel free to add them here

I do not know any, but maybe one of the following would fit?