WordPress.org

Forums

EWWW Image Optimizer
Feature Request: JPEGMini and TinyPNG (44 posts)

  1. ianarmstrong
    Member
    Posted 1 year ago #

    Some of the best compression algos in the game are paid (no surprise) instead of free. As I have API access to a TinyPNG API key (https://tinypng.com/developers) and a VPS with a JPEGMini server (http://www.jpegmini.com/server) on board, I would love to be able to aim this plugin at those locations.

    Give them a try. The results are pretty stunning. Manual conversions are free online.

    Still, thanks for a working alternative to Smush.it for optimizing images!

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

  2. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Definitely two very impressive services. I'm still brainstorming the possibilities here, but here's my initial reactions...

    The optimized images from both services are intended to be visually identical to the originals (and by all appearances, they do a fantastic job of this). However, the optimizations are not lossless, as the images undergo lossy compression techniques to achieve the savings that are seen. Based on that, I am inclined to deny it for inclusion in the plugin, since our focus is on lossless optimizations, and I tend to steer people towards other plugins that already do lossy image optimization (Imsanity among others).

    Additionally, this plugin started with a focus on running optimizations locally, which has a variety of benefits. The cloud service I launched a few months ago was done only to serve those who cannot (or don't want to) run the optimizers on their own servers for whatever reason.

    If there is enough interest, I may approach either company to see if they would be willing to sponsor development of a separate plugin that would integrate with EWWW Image Optimizer.

    I'll stick this topic so that others can add their opinion or vote for this feature request.

  3. Shreejee
    Member
    Posted 1 year ago #

    +1

    Also, what about WebP? Can that too be implemented?

  4. ianarmstrong
    Member
    Posted 1 year ago #

    Hey Nos,

    Thanks for taking the time to reply. I can appreciate that your goal has been lossless compression and I think it's a good idea to continue giving people that option. Your principles are sound.

    With that said, we're talking about 60%+ additional file compression with almost undetectable visual changes to the naked eye. When we're dealing with clients who flock like sheep to DreamHost, BlueHost, and other metered providers - we're suddenly talking about an enormous difference in page load time.

    Perhaps the best solution is a compromise. Might I suggest that you always save original using lossless optimization, but allow the thumbnail images to be processed through more aggressive means? This would allow us to significantly compress the data transmitted on most page loads without sacrificing quality where it is expected.

    Your solution is better than any other on the plugin market but, at this point, I'm still downloading the monthly uploads folder for 30+ clients during the first week of each month and compressing every thumbnail manually (originals too in many cases, where quality is less important than efficiency). It's a back breaking task.

  5. ianarmstrong
    Member
    Posted 1 year ago #

    The other thing that I'd love to see supported is an automatic conversion to progressive JPG before processing. It's like... a 3 line change in the WP core. I haven't yet explored the best way to enable it with a plugin but if WP first makes all thumbnails progressive, then converts non-animated GIF to PNG, then aggressively compresses the reduced sizes.

    Boy, that would be amazing.

  6. ianarmstrong
    Member
    Posted 1 year ago #

    Sorry, one last thought before I go back to doing real work :)

    "Additionally, this plugin started with a focus on running optimizations locally, which has a variety of benefits. The cloud service I launched a few months ago was done only to serve those who cannot (or don't want to) run the optimizers on their own servers for whatever reason."

    When you're on a WiredTree or Liquidweb VPS, it makes sense to do everything you can locally, since you've got the resources for it. When you're freelancing and a client is on a metered host (80% of all cases in my experience) then you get as far as you can from memory & CPU intensive processes. The 15 min throttle is a killer.

  7. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    @Shreejee, WebP has already been discussed, see this thread: http://wordpress.org/support/topic/feature-request-graphicsmagick-webp?replies=3

  8. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    I'll tackle your last couple posts, because you bring up some interesting possibilities.

    Lossy compression does make more sense for thumbs/resizes, since these are probably never expected to be as good as the originals, and most would not care, so long as they were visually identical to what WP generates natively.

    Then your next post, I think we are 2/3 of the way there already (correct me if I'm missing something):
    1. EWWW IO already attempts progressive and non-progressive optimizations, and chooses the smallest of the two.
    2. EWWW IO can already convert GIF to PNG (but you probably already knew that).
    3. implementing TinyPNG and JPGMini will effectively enable 'aggressive compression', without any noticable loss in quality.

    We'll still need sufficient interest to implement either of these services, since it will take a decent amount of work to make it happen.

    Anyone who has made it this far, feel free to add your +1 to this thread.

    And regarding your last post: Yes, I've definitely seen some who are technically capable of running the optimizers locally, but choose not to. I've even had some contact me directly who are in a similar place as you; they have lots of clients on minimal hosting platforms and it doesn't make sense to run optimizers locally. That's partially why I didn't limit the cloud api keys to a single website. You could use a single key on 1000 websites, so long as you don't exceed your quota, it will keep right on going.

  9. ianarmstrong
    Member
    Posted 1 year ago #

    It sounds like we're in agreement on the best solution. Now it's up the community to rally behind the concept, or shrug and shuffle along :)

  10. Jeremy Dawes
    Member
    Posted 1 year ago #

    sounds good. the more we can reduce the file size the better the result for the browser and google will be happier. +1

  11. MattV
    Member
    Posted 1 year ago #

    BTW: TinyPNG seem to use the free PNGquant library - they´re listed on PNGquant´s homepage as one of their GUI tools. Not sure if they use it in conjunction with anything else. - http://pngquant.org/

  12. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    My understanding was that TinyPNG uses some of their own techniques that are proprietary, but they probably use free tools as well. I'll do some digging on that front and see what I come up with.
    There are some excellent resources on the pngquant webpage as well, so Thank You for the tip.

  13. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    After doing some testing, I suspected the used pngquant in conjunction with something like zopfli compression. I can mostly replicate their results, but I still get some surprising savings on a few images. It's possible they are just using a lower max value for pngquant, and I'll toy with that more tomorrow.

  14. ianarmstrong
    Member
    Posted 1 year ago #

    I'm so psyched that you are going forward with a lossy compression option on the thumbnails. It's going to make this far and away the best plugin on the market.

    Another quick aside - P3 has a pretty damming view of the plugin:
    http://screencast.com/t/plsQkFljeee

    We should run though the source and make sure Ewwww is only ever being called conditionally when the media gallery is active. Otherwise, it's going to be a real CPU hog. Please bear in mind that I haven't really investigated things yet. If I had, I'd have made a new OP about it.

    My concern here is, generally, that once you get a lossy option in for thumbnails the plugin will become very, very, very popular. At that point, we'll want to make sure it's as slim as possible - to the point of being invisible unless it's compressing stuff.

  15. ianarmstrong
    Member
    Posted 1 year ago #

    (Yes, that's Ewwww - I know the two purples are confusing)

  16. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, that concern has been raised before, and mostly addressed. The next release moves even more code out of the initial load (not that the code being moved was actually doing anything, but every ms counts), so that will be even better yet. EWWW is pretty heavy on the admin side, but it barely does anything on the front-side unless it is called for.

  17. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, I did more extensive testing, and realized that pngquant will often reduce an image even on subsequent runs, because it is lossy, so it is just like saving a jpeg multiple times, you lose data nearly every time.

    I used this combination: pngquant, then optipng, then zopfli (via advpng) or pngout for compression.

    There were a few images where tinypng still beat this combination, but overall, I was able to beat tinypng by about 10% (~30kb) on a test set of 28 images (~500kb).

    That's very promising, as it means users will be able to do lossless PNG optimization without paying for another external service. JPEGmini is something else altogether, and neither will be implemented anytime soon, but now I at least have somewhat of a plan.

  18. davidroccato
    Member
    Posted 1 year ago #

    I just want to add my +1. :)

  19. KeenMetal
    Member
    Posted 1 year ago #

    +1, thank you so much for making this happen!!

  20. electricbrick
    Member
    Posted 1 year ago #

    +1 as well. Both TinyPNG and JPEG Mini are hidden gems, and to see them integrated into a WordPress plugin would be a boon to the community.

  21. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, need some feedback from all of you, if you don't mind?

    The original plan was to implement the lossy optimizations for resizes only. While this is technically feasible, it's not very elegant, and I wonder if we wouldn't be leaving out a lot of images where folks would want to use the lossy option. Even worse, I was planning on just doing resizes from the Media Library, and the supported gallery plugins. So what happens to all the stuff we run through the 'optimize more' functionality?

    A slightly better option is to just hook it into the wp_image_editor implementation that the plugin uses, so that anything WP edits would have lossy optimization (at least for plugins that do things the 'right' way).

    Again, even though that seems pretty safe, I have two concerns:
    1. There are still probably going to be images that folks would rather use the lossy optimization on.
    2. It's going to be rather difficult to inform users on what IS and ISN'T using lossy optimization. Worse, I wouldn't even be able to tell them without looking at the code for any and every plugin that users might ask about.

    So... I think I'm going to have to revise the plan, and enable lossy optimization for EVERYTHING. I'm sure Ian is already cheering, haha. Anyway, please give me some feedback on that. Is it great? Is it wonderful? Or are there drawbacks? I don't do a lot of image heavy websites, and very few PNGs, so it would be great to get some insight from those that it would affect more.

  22. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Also, I've already implemented pngquant (lossy PNG) on the cloud side, now I just have to compile it 15 different times for the rest of you so I can enable it in the core plugin. Planning to have it done next week sometime.

    JPEGmini is still a ways out, been emailing them back and forth trying to figure out the best way to integrate, and hoping they'll give me some sort of kickback to lessen (or eliminate) the cost of development. If they refuse, I might have to see if someone wants to either sponsor a JPEGmini server for a couple months, or give me access to an AWS instance.

  23. davidroccato
    Member
    Posted 1 year ago #

    Hmmm, well I'm not sure if I understand all the process but I would be concerned about quality. With more than 5000 images I wouldn't risk to damage the quality too much.

    For example, in the settings "optipng optimization level", I have set up the level 3: 16 trails, because the level 2 wasn't giving back enough quality.

    I personally now use only JPG but I tried tinyPNG with a few of what I had and the output wasn't great at all. The quality of the image was too bad for me, at least on my tests. Now, for a thumbnail, who cares, but for main images is different. If someone does the bulk optimisation without taking any precaution, he could end up with a bad surprise. Imho.

  24. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    That's what I wondered, hopefully a couple other folks will weigh in on this as well.

    Regarding optipng, that doesn't make any sense, because optipng is totally lossless. It doesn't have the ability to degrade the image quality, it only reorganizes the image data that already exists to achieve the best filesize. Even if you convert a JPG to PNG (for things like logos and such), it can't degrade the image, because an exact pixel by pixel copy is created, and then optimized with optipng.

  25. davidroccato
    Member
    Posted 1 year ago #

    I don't know, I can't remember anymore what the problem was at that time because there was also the problem of 2 steps as it didn't convert Jpg to png in the first step. I remember I was optimizing the first images one by one to check how they were and with level 2:8 trials the results were not good so I went for level3:16 trials and they were good, so I set up that level and start bulking.

  26. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, ok. The levels are compression settings, not quality settings. Just to explain a little better the way PNG optimization works:
    PNGs are stored using zlib compression, which has several different parameters (and different compression methods even). So, what optipng does, it it tries different parameters to get the best compression level (each combination of parameters is a 'trial'). At level 1, it tries what it thinks is the best combination. At level 2, it tries 8 different combinations, and so on. It's a nearly exponential process, so higher levels use much more CPU, but there generally is very little savings over level 3. Level 2 is the default because it does pretty good without overtaxing your CPU, but level 3 will usually squeeze out some more savings. Optipng also does some other things to try and achieve better storage size, but that's the gist of things. PNGOUT does some of that, but uses it's own special zlib algorithm which achieves results similar to the zopfli algorithm, so it can often make an optimized image even smaller, but at the cost of more CPU usage.

    TinyPNG (and pnquant) actually reduce the color pallette to achieve their savings, so they discard some colors, resulting in a quality loss, which is generally imperceptable. But apparently you're more perceptive than the average person, hah!

  27. davidroccato
    Member
    Posted 1 year ago #

    :D Thanks for the explanation. And yes, maybe I pay more attention because it's for a photography site after all and I also watch thousands of pictures every week. So I usually accept a loss in quality for the web but not if it's going to change the general visual impact. It really depends on the type of pictures, or even screenshots and yes, tinyPNG does a great job but probably it depends on the quantity or type of colours inside each different image. I was impressed by the saving of kb but I couldn't be generally satisfied for all tests. And they offer just one possibility, and there's no way to choose a level 1, or 2 or 3, for example. So, that's why I wouldn't risk it for a bulk optimisation.

  28. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    It might be interesting for you to try a direct pngquant implementation. My plan currently is to use the default setting which attempts the least quality decrease. Check pngquant.org for a program that you can use on your OS, and see what you think of the results.

  29. KeenMetal
    Member
    Posted 1 year ago #

    All our product images (~1000) are all PNGs as we use the alpha channel.
    In the product catalogue, images are loaded by the dozens in relatively high-res (retina display craze now).
    For us, we accept a minor decrease in quality in return for much faster loading. Waiting visitors that are just quickly browsing, especially over slower connections, are much more likely to bounce.
    TinyPNG's standard savings are fantastic for us.

  30. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    I'd like to see more feedback, so if anyone else is following this thread, feel free to put in your thoughts on the matter.

    I DO have an idea though. I was originally trying to think about how to catch all the weird edge cases, and make sure resizes from the Media Library, NextGEN, FlaGallery, and others would get lossy optimization. In other words, I was trying to think of how to INCLUDE every image where people would want lossy optimization applied.

    What if we instead focus on what to EXCLUDE? While I hate adding options, it almost seems unavoidable that the best approach here is to have an option to exclude full size originals from lossy optimization. I think this would be way easier from a programming standpoint, since there are less images to think about.

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