-
-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Losslessly compress PNG files. #534
Conversation
Used `optipng -o7` and `zopflipng`. Before: 3,89 MB (4.084.200 bytes) After: 2,14 MB (2.245.311 bytes)
@XhmikosR Thank you! Can you please share the exact commands that were used to do that? |
If you are trying to reproduce the exact savings you won't be able :) I'm using my custom scripts which are Windows only. The basic commands are:
|
Would it be possible to create a JS file in Perhaps using |
Nope, because not all tools are available for all platforms. optipng and zopflipng are cross-platform but pngout isn't. |
Also, remember what I told you Slack :) I'm not familiar with webpack otherwise I would have added svgo myself. But in general I say after this gets merged you can add https://www.npmjs.com/package/imagemin-webpack-plugin and I can help setting it up. Remember, my compression results are the best possible. This is just lossless compression BTW. Lossy the savings would be ~2x. |
It's great to have the images compressed, it's better if we have a methodology that anyone can use to do it again. Would that do the job for Looks like this is providing cross-platform binaries. |
It could work, sure. But like I said, I ran everything with the maximum options. Normally, in a build step, you won't do that, because it'll take a huge amount of time. |
This doesn't need to be integrated in the build process. Just a JS script in the |
You can add a script, sure. I don't have the time to do it nor am I familiar with webpack. It already took me many hours to achieve these results. |
@XhmikosR, thank you very much for the time you did invest in this. It's really appreciated 🙏 As an Open Source project, it's important to understand how things are working, share the knowledge with the community, in that case reproduce the optimization process. If you have custom scripts and tricks that are too complicated to share, we understand, achieving 90% of that with sensible options would already be a great win for us. So, based on your input, I created a branch with a simplistic first version of such script. At this stage, this doesn't touch webpack at all. #540 |
I'm aware how open source works ;) The thing is that a random script means nothing. Everything should be hooked up in your build process. |
@XhmikosR I'm up for integrating image optimization in the build process, and we're gonna do something there. But as you said, this kind of lossless compression is too slow to be integrated in the build. |
Agreed. I suggest that this gets merged and we hook up a webpack plugin later. There's still the SVGs which I didn't make a PR because those should definitely be minified on build time. |
Used
optipng -o7
andzopflipng
.Before: 3,89 MB (4.084.200 bytes)
After: 2,14 MB (2.245.311 bytes)