svgexport icon indicating copy to clipboard operation
svgexport copied to clipboard

Compress png files

Open Chaz6 opened this issue 10 years ago • 8 comments
trafficstars

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.

Chaz6 avatar Jun 03 '15 15:06 Chaz6

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.

shakiba avatar Jun 03 '15 15:06 shakiba

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 avatar Oct 09 '15 01:10 praneybehl

@praneybehl Thanks, it is interesting, it may be possible to directly use their optipng-bin package.

shakiba avatar Oct 09 '15 01:10 shakiba

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 avatar Oct 09 '15 01:10 praneybehl

@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.

shakiba avatar Oct 09 '15 02:10 shakiba

@praneybehl I fixed another issue and before committing I added some comments to examples, please feel free to edit them if required.

shakiba avatar Oct 09 '15 06:10 shakiba

@shakiba thanks really appreciate it and will do.

praneybehl avatar Oct 09 '15 07:10 praneybehl

I just use https://github.com/lukeapage/pngjs to read and write a PNG file and it becomes compressed.

mitar avatar Nov 14 '16 04:11 mitar