svgexport
svgexport copied to clipboard
Compress png files
When converting svg files to png files the resulting files are extremely large (e.g. 1MB for a 512x512 image). I was able to achieve an average of 99% compression using pngcrush. It would be useful if svgexport could automatically compress the output.
You are right, but this is actually a phantomjs issue. If you find a solution which can be bundled in a node/npm package, please either submit PR or just let me know.
You can probably integrate https://www.npmjs.com/package/imagemin for png image compression add/pass it as an option.
Hope it helps :+1:
@praneybehl Thanks, it is interesting, it may be possible to directly use their optipng-bin package.
Yes, I just did a test run where I had 310 svg files to convert to png at default size 400x300 they were all 432kb and then I ran then through optipng and their sizes were dramatically reduced to between 28kb to 50kb depending on the image type. I think It would be a great addition for optimizing export file size.
Also a request if you don't mind me asking in this issue is that it would be great to have some details in the readme/docs for this package. Although I see you have the examples layed out but with the examples there is some guess work involved. It would be great to have a comment for each example stating which argument represents what variable.
Thanks for the quick response and also for creating this great package. Cheers! :+1:
@praneybehl Thanks for you suggestions, however currently I really don't have enough time, today I'm fixing an old critical bug after several weeks! So please fell free to edit docs and make a pull request.
@praneybehl I fixed another issue and before committing I added some comments to examples, please feel free to edit them if required.
@shakiba thanks really appreciate it and will do.
I just use https://github.com/lukeapage/pngjs to read and write a PNG file and it becomes compressed.