aitte Posted September 18, 2015 Share Posted September 18, 2015 Would you be able to include the world's best PNG compressor in the export features? It usually produces files 60-80% of the Affinity PNG size and is available as a C library. The compression is the best in the world, and the only feature they lack is extra-advanced palette optimization (it does optimize, but could be even smarter, it is on their todo list), but even without that they're still smaller than all other PNG compressors.License is apache 2.0 = free for commercial use if you attribute them in the about-box.Project was made by Google employees.If you include it then please preserve control over the various tuning/algorithm parameters (you'll see what I mean if you try their command line version), because that is how to achieve the best compression. anon1 and A_B_C 2 Quote Link to comment Share on other sites More sharing options...
aitte Posted September 26, 2015 Author Share Posted September 26, 2015 To show the results for some graphics, here are some compression numbers. The "Input size" is the size that was created by Affinity Designer, and the "Result size" is the zopflipng result. + $ ./zopflipng --filters=01234me -m ~/Downloads/backgrounds.png ~/Downloads/backgroundzop.png Optimizing /Users/Aitte/Downloads/backgrounds.png Filter strategy zero: 152892 bytes Filter strategy one: 109296 bytes Filter strategy two: 115480 bytes Filter strategy three: 113140 bytes Filter strategy four: 107029 bytes Filter strategy minimum sum: 105744 bytes Filter strategy entropy: 105074 bytes Result is smaller Input size: 130432 (127K) Result size: 105074 (102K). Percentage of original: 80.558% + $ ./zopflipng --filters=01234me -m ~/Downloads/test.png ~/Downloads/z.png Optimizing /Users/Aitte/Downloads/test.png Filter strategy zero: 108460 bytes Filter strategy one: 97149 bytes Filter strategy two: 100206 bytes Filter strategy three: 101311 bytes Filter strategy four: 98841 bytes Filter strategy minimum sum: 98427 bytes Filter strategy entropy: 97128 bytes Result is smaller Input size: 124845 (121K) Result size: 97128 (94K). Percentage of original: 77.799% Also, you will notice I ran with all filters (01234me), but they recommend "0me" because usually one of those three is gonna be the winner. So a good default profile is "0me". And the extra "-m" flag I specified just makes it do more iterations to try to make the file even smaller, but usually that's not needed. ronnyb 1 Quote Link to comment Share on other sites More sharing options...
anon1 Posted September 27, 2015 Share Posted September 27, 2015 Sounds very promising! Quote Link to comment Share on other sites More sharing options...
Staff Andy Somerfield Posted October 7, 2015 Staff Share Posted October 7, 2015 Sorry I didn't get to this sooner - if it does what it says it does, and the licences are as quoted, I will certainly look into it.. Thanks, Andy. anon1 1 Quote Link to comment Share on other sites More sharing options...
aitte Posted October 9, 2015 Author Share Posted October 9, 2015 Hi Andy! Yep I just verified that the license is Apache 2.0 even for the PNG part: https://github.com/google/zopfli/blob/master/src/zopflipng/zopflipng_lib.h Good luck and have fun investigating this. It would certainly remove the advantage photoshop has in the "export for web" filesize department. If it makes it into Affinity, I suggest something like an export checkbox saying "Optimize Filesize (Slow)" which runs the "0me" algorithms with the default iteration count (usually, but not always, finds the smallest filesize and does it reasonably fast). And an "advanced" button to enable other algorithms or increase iteration count. And... Since zopfli is somewhat slow, it may be worth showing a progress window which shows the algorithms it's trying and what sizes it finds, while the user waits (i.e exactly what the command line tool above outputs). Maybe as some nice "size" bars to get the user excited about getting efficient files for the web. That feedback also helps a lot; i.e next time you wanna export the same resource you may know that the "e (entropy)" algorithm was the correct one for that particular image, and can uncheck the rest to save time. Maybe the GUI could even help do that automatically. Well, there are lots of considerations so I'll let you have fun exploring the tool and checking it out now :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.