WordPress.org

Forums

EWWW Image Optimizer
[resolved] Option to use PNGout and to enable/disable programs (10 posts)

  1. Daedalon
    Member
    Posted 2 years ago #

    I would love the option to use PNGout (Linux builds) side-to-side with OptiPNG. Optimization expert Sergey Chikuyonok's words:

    passes image in chain–OptiPNG first, PNGOUT last–which produces best results.

    On CodingHorror's tests PNGOUT was more effective:

    OptiPNG PNGOUT
    4.40 MB 4.04 MB

    It took a while to run, but we get a further 9% reduction in PNG image size beyond what OptiPNG could do.

    Though that article is dated, I've encountered similar results in my own usage during the last month: running an image through OptiPNG after having already optimized it with PNGOUT resulted in an increase in file size. This shouldn't happen, and I may have been mistaken, but if I can reproduce this later, I'll file a bug report to OptiPNG.

    I did a test, however, to find a case when the opposite of the above is true, using http://s.wordpress.org/style/images/wp-header-logo.png:

    6 894 bytes: initial size
    6 894 bytes: after optipng only
    4 130 bytes: after optipng and then pngout
    4 130 bytes: after pngout only
    3 983 bytes: after pngout and then optipng

    Similar results with the Slashdot.org logo http://a.fsdn.com/sd/logo_w_l.png:

    916 bytes: initial size
    628 bytes: after optipng only
    540 bytes: after optipng and then pngout
    547 bytes: after pngout only (worse than when optipng was used first)
    517 bytes: after pngout and then optipng

    On a random screenshot the results were not much different: PNGOUT provided better compression than OptiPNG, but using both in either order produced the same size of file as using PNGOUT only.

    Based on this sample, although very inconclusive, I'd say that if the two plugins should be in a fixed order, PNGOUT should come first. Both programs were run with maximum compression settings, optipng with arguments -o7 -zm1-9 and PNGOUT as an IrfanView plugin.

    Suggested changes for the plugin in summary:

    • Add support for PNGOUT
    • By default, have PNGOUT run first and OptiPNG after
    • Add a checkbox to quickly enable/disable each optimization (jpegtran, pngout, optipng, gifsicle)

    http://wordpress.org/extend/plugins/ewww-image-optimizer/

  2. nosilver4u
    Member
    Plugin Author

    Posted 2 years ago #

    pngout definitely seems like something worth pursuing. Who knows when I'll have time for it, but it definitely will get added to my future features list.

    I would concur that it seems pngout should run before optipng, and since png optimization is so expensive (for the CPU) in the first place, we don't want to try both ways for every png 'just in case'.

    Regarding the options to disable each optimization, what do we gain? I'm all for flexibility, but I'm not sure why you would need to disable any of the tools.

    Lastly, a comment on screenshots since you mentioned them. I've noted myself that linux (at least Gnome, maybe not KDE) saves screenshots as PNGs, which is generally very inefficient (modern GUIs use lots of gradients, which is bad for PNG). So just an FYI, you may want to try saving some PNGs as JPGs. You could see significant size reduction in this area.

  3. Daedalon
    Member
    Posted 2 years ago #

    Disabling one or more of the tools could be done for example to share gifs which don't need gifsicle --unoptimize before being editable, to use only PNGOUT or OptiPNG but not both, or general testing reasons. A checkbox to the left side of each plugin filesystem location should do the trick.

    A good plugin - or any piece of software - provides good defaults and the necessary options to cover other use cases flexibly. The above guarantees the latter, and for the defaults, the heavier one of those two (PNGOUT, I believe) could be turned off by default to not have support issues "I turned it on and it's all good but adding an image takes forever". Those more advanced users who want the maximum compression using PNGOUT or both of them would find the options for these at the plugin settings.

    Later, at the point when I manage a site with a huge png traffic, I'll do more extensive testing with the order of running OptiPNG and PNGOUT. It could be that to cover all options one of them should be run twice (eg. OptiPNG first, then PNGOUT, then again OptiPNG -> now both have been run once after the other). If we reach the point where that is useful, we'll likely contribute a patch for enabling that and possibly others (eg. to do the processing remotely on another computer), if EIO still then is what we use for optimization.

  4. nosilver4u
    Member
    Plugin Author

    Posted 2 years ago #

    Just an update (no code on this yet unfortunately):
    I've spoken with the pngout team, and users would need to download pngout 'manually', but there should be no problem automating this quite a bit, since they have a standalone linux binary freely available.

    It will probably just be something like 'click here to download and enable pngout for extra optimization' and then the plugin will retrieve and unpack it for you and then we have a hardcoded path and avoid any security issues on this particular tool. We can also provide the user with information to download it completely manually if they so choose.

  5. Daedalon
    Member
    Posted 2 years ago #

    Automated installation is a very good idea. Ideally the user wouldn't even need to click anything after Activate to have their images stay optimized.

    Some profile settings are necessary to choose between eg. maximum compression (that is, to run OptiPNG, then PNGout, then OptiPNG again with max settings) or a lot faster decent compression (just running OptiPNG once). Siteadmins would then choose their settings depending on their use case:

    1. A site with tons of images and loads of bandwidth but not much free CPU would choose lower compression settings.
    2. A site with less images and bandwidth but lots of free CPU would maximize any compression settings they can.

    If the plugin gets popular with some image-heavy sites, I'm pretty sure someone will write a patch that will let the calculation processes be done on a different computer than where the WordPress is located. The most image-heavy sites will also be the first ones to switch from the automatically installed compressors to ones they compiled themselves to take full use of their CPU's features.

  6. nosilver4u
    Member
    Plugin Author

    Posted 2 years ago #

    I've committed the pngout functionality to the latest dev version. I'll probably release it tomorrow, but if you want to test it out early and give me some feedback, it's available for download via the Developers tab on the plugin page.

  7. Daedalon
    Member
    Posted 2 years ago #

    Good to hear. On our part it'll take latest until October since we'll be looking into these optimizations. When that time comes, it's probably time to take a shot at CloudFlare. It's might not be for every project, so we might end up using them for some and a more custom solution (eg. this plugin) for others.

  8. nosilver4u
    Member
    Plugin Author

    Posted 2 years ago #

    I use cloudflare for all my sites, but I wasn't aware they had any image optimization functions. I'll mark this as resolved once I release 1.1.0

  9. Daedalon
    Member
    Posted 2 years ago #

    They call it Polish, and it's available in all plans with the exception of free: https://www.cloudflare.com/plans

    How does CloudFlare work for you in terms of images? They write that they cache your images. Is that the same as in serving them for you, in other words practically paying for your image bandwidth for you?

  10. nosilver4u
    Member
    Plugin Author

    Posted 2 years ago #

    I only use the free plan, so I don't have Polish. I suppose if they cache the images, then they are serving them for you. However, unless you are on a paid plan, they only cache things that have been requested recently.

    Also wanted to let you know that I've released 1.1.0 with pngout and options to disable each tool.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • EWWW Image Optimizer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.