Tuesday, December 13, 2016

A Comparison: Google Photos vs. JPEGmini--how does Google's new compression compare to the gold standard in lossy jpeg compression?

All,
It seems I'm a little late to the party discussing Google's new photo compression performance, but perhaps I have something to add.
I've been using a program called JPEGmini for a couple years, now, to compress my JPEG images. Its compression of JPEGs is lossy, but it claims to do so leaving the perceptual image quality virtually unchanged. Far as I can tell, its claims are pretty accurate, and it has literally helped me cut the size of some of my picture folders in half.
As I'm sure most of you are aware, yesterday Google unveiled Google Photos, and with it announced unlimited storage space for photos and videos. The unlimited part comes with a caveat: Google will apply lossy compression to your files.
Like JPEGmini, Google claims to be able to apply lossy compression to images without changing the perceptual quality of the image. If you analyse the uncompressed and compressed images with a computer, you can see differences--but by eye, they look identical.
So I a did a little test with a bright image to compare JPEGmini's compression with Google's compression.
Take a look at this image:
This shows a comparison between the uncompressed image, Google's compression, JPEGmini's compression, and finally JPEGmini applied to an already Google-compressed image.
You can decide for yourself if there is any loss in visual acuity between the original, the Google-compressed, the JPEGmini-compressed, and the double-compressed image. To make it easier to view the images side-by-side, here's an imgur album with each individual frame, which you can load it separate browser tabs and click back and forth:
Below, I've produced a table showing the different compression ratios.
MethodBeforeAfterCompression
None4.03 MB4.03 MB0%
Google4.03 MB2.09 MB93%
JPEGmini4.03 MB1.75 MB130%
Google + JPEGmini4.03 MB1.08 MB273%
In my personal opinion, all four images have the same perceptual image quality. Google's method is remarkably good. The reduction in image quality is almost imperceptible, yet it manages to nearly cut the file size in half. On the other hand, JPEGmini manages to eek out an extra 40% compression with only trivial image degradation. Most remarkable of all, though, is that by combining the two--Google and then JPEGmini--it doubled the compression even of the already-compressed image! Of course, the double-compressed image has the most notable degradation of image quality, but even so, it is so minor that, I think, it is still almost certainly unnoticeable in large photographs.
Finally, for a more rigorous analysis of the actual differences between each of the four test cases (original, Google, JPEGmini, Google+JPEGmini), I loaded them up in Photoshop and used the difference layer effect to calculate the actual changes in the original image that the compression algorithms performed. You can see that, here:
What should be immediately clear is that Google's compression algorithm was the least degrading by a long shot. The original, uncompressed image was only very slightly altered by Google's method, and yet it still was able to nearly cut the filesize in half. JPEGmini's compression is good, too, eeking out an extra 40% compression over Google's while still causing relatively little damage to the original photo. The biggest jump in image quality degradation is from applying JPEGmini to an already Google-compressed image. No pain no gain, I guess, but even so, I think it exhibits remarkably little degradation consider it is nearly a 100% improvement over either Google or JPEGmini's algorithms alone.

edit:

I redid the comparison with a little bit better image. The original image was just a photo taken on an 2014 Moto X. This time around, I used a studio test image taken by a Nikon D750 DSLR ($2000 camera) taken from DPReview.com. Because Google only allows a max photo size of 16 megapixels and the original test image was 24 MP, I downloaded the RAW format shot and resized it down to 16 MP in Photoshop before starting the test.
You can grab the new test images, here on Image compression.
And now the updated table
MethodBeforeAfterCompression
None4.07 MB4.07 MB0%
Google4.07 MB2.43 MB67%
JPEGmini4.07 MB2.70 MB51%
Google -> JPEGmini4.07 MB1.66 MB145%
JPEGmini -> Google4.07 MB1.99 MB104%
This time the results are a little bit different, and there are some interesting results. Google's algorithm performs a little bit better, and we see that the best overall compression is still when you perform a Google compression first, and then a JPEGmini compression on top of it.
Taking a look at the difference maps, we can see that JPEGmini and Google compress the JPEGs a little bit differently. JPEGmini's difference maps are all nearly monochromatic. This means that JPEGmini isn't altering the colours of the original image very much. Google, on the other hand, is altering the colours quite a bit (example). That's not necessarily a bad thing if Google can compress colours imperceptibly.
...But here's the thing--it doesn't. Take a look at the colour wheels just to the right of the bottles at the bottom of the original image. JPEGmini compresses these well, but Google creates some nasty outlines around the edges of the circles (image). Other than that, both JPEGmini and Google crush the details in the grey background differently, and I suspect that it's up to personal preference as to which one is better.
Overall, I think Google and JPEGmini both have impressive algorithms. Google's beats JPEGmini in compression some of the time, but it looks like there are still some kinks to work out to prevent aberrations and other artefacts. Nevertheless, I suspect that this is something Google will improve over time. Given that Google has their own web browser and their own mobile OS, they're more than capable of even pushing out new image formats or new standards, if they wanted to. Until then, if you have some important images that you want to save from minor image artefacts, it might be prudent to keep an extra backup outside of Google Photos.

edit2:

/u/men_cant_be_raped brought to my attention MozJPEG. I followed through with the same kind of comparison on it, which you can see in my reply, here. I've also updated the archive of full-sized images, which you can download here.
MozJPEG is really impressive. Whereas JPEGmini's difference map shows a lot of monochromatic changes in the original image, and Google's shows a lot of colour changes, MozJPEG does the best of both worlds. I was able to figure that MozJPEG with a -quality setting of 91 was almost identical to Google's compression in visual quality, and it managed to also shave off a little bit more filesize. MozJPEG -quality 91 came in at 2.33 MB, while it was 2.43 MB for Google, and 2.70 MB for JPEGmini.
Unfortunately, MozJPEG has the same ringing effect on the coloured circles, which you can see in this Imgur album:
Comparison of Original, JPEGmini, Google, and MozJPEG:
Difference maps of the above (brightened for ease of viewing)

No comments:

Post a Comment