I develop a premium theme Stallion Responsive which has built in Gravatar caching for performance reasons. When Gravatars aren't cached Google Page Speed Insights downgrades the page loading the Gravatars because gravatar.com sets it's cache time frame to only 10 mins (should be at least 7 days).
So to improve page speed Gravatars are cached within the themes folder as jpg's under.
or if a child theme installed
The site linked to above has the Gravatar caching turned on and your plugin installed, it's also got hundreds of comments, so plenty of cached Gravatars.
The theme can be downloaded for free (download link on the site above) and run in demo mode which includes the caching option if you need to test it.
Running your plugin on the cached Gravatars (via the bulk optimize scan option) give some nice savings sometimes over 50% (so my theme caching code isn't doing a great job compressing the Gravatars apparently :-(), so I'd like to optimize the images ideally as the Gravatars are cached, though that might be asking a lot.
Doing it manually takes too long, the child theme includes a lot of header and thumbnail images (about 1,000 theme images), so it will have to scan over 1,000 images every time. I've already run the images built into the theme and the free child theme with your plugin before creating the zip files, so the theme zip file includes the images optimized by your plugin, so it's overkill running them all again every time I want the Gravatar cache optimized.
The Gravatars are cached when a visitor accesses a page with an uncached Gravatar and the cache expires on a regular basis: by default it's set to 168 hours (7 days), but this can be changed.
Can be quite a lot of images, I use the domain mapping plugin for some sites (means one WordPress install can run dozens of domains) and one setup that has just 6 sites running on it there are almost 500 cached Gravatar images and those aren't even highly commented sites. I have some sites with 30,000+ comments, so going to be a lot of images that could be optimized. Just checked my most commented site and there's over 11,000 cached Gravatars in the folder (50MBs of images).
Any ideas on optimizing the cached images without having to use the manual option?
While I'm asking :-) The theme also uses Timthumb.php, I'm finding the cached Timthumb images are sometimes shown as not being fully optimized when checking Google PageSpeed Insights tool. I don't know why some are and others aren't listed by the tool. The cached images don't have a jpg, gif etc... file name, they have file format txt so your plugin I assume wouldn't by default optimize them anyway.
Under Optimize image:
Losslessly compressing http://stallion-theme.co.uk/…s/adsense-click-fraud.png&w=50&h=50&q=75 could save 824B (24% reduction).
which is this Timthumb cached image: http://stallion-theme.co.uk/wp-content/themes/stallion-responsive-child/timthumb.php?src=http://stallion-theme.co.uk/wp-content/uploads/adsense-click-fraud.png&w=50&h=50&q=75
Have you any experience improving Timthumb image optimization?
Interestingly I haven't run the bulk scan option on the site above and yet none of the cached Gravatars (which aren't optimized) are listed as an issue. I picked that tutorial page because it has a full page of threaded comments (must be over 30 comments) so plenty of unoptimized cached Gravatar images loaded. I guess your plugin optimizes images to greater degree than Page Speed Insights looks for, so even though they aren't optimized at the level your plugin works to, they aren't bad enough to be considered an issue by Google.
Great plugin, within my theme on the Performance options page I recommend my users install your plugin.