ImageOptim



ImageOptim Web Service (HTTP API) — resize and optimize images in your web applications. Online interface — a JPEG compressor that produces smaller, higher. Images are made smaller (in terms of disk size) by recompressing them using best combination of compression settings, bettter algorithms, and by removing optional, invisible information like. The extension ensures the on-fly conversion of product images to a new webp format. Web pages are loaded faster thanks to the smaller size of images. Webp format is supported by major browsers now. The extension enables to also setup level of image compression so the final image has a significantly smaller size in kB.

For years I've leaned on ImageOptim as my go-to for image optimization. I tend to be a little obsessive, using modern formats (WebP, JPEG 2000) and testing out avant-garde projects like Guetzli by Google. I recently decided to finally try out Squash by Realmac Software.

ImageOptim

Over the years, codecs have improved remarkably, especially in the realm of video: For example: H.261 (1984, 1988) -> MPEG-1 (1988-1991) -> MPEG2 aka H.263 (1996-2015) ->MPEG4 aka H.264 (1999-current) -> High Efficiency Video Coding (HEVC) aka H.265 or MPEG (2015 - current). Each iteration with the ultimate goal of improving video quality with at lower bit rates. This doesn't even cover the other formats, VP8, VP9, Ogg Vorbis, DIVX, 3IVX, Sorenson, Real Media and the many others that occurred the past 30 years which all have had variations of mainstream success. Audio has had a similar vector from LMA4:1, Mpeg, MP2, Mp3, ACC, Ogg, AC3, DTS to name a few.

ImageOptim

ImageOptim is excellent for publishing images on the web (easily shrinks images “Saved for Web” in Photoshop). It's useful for making Mac and iPhone / iPad applications smaller (if you configure Xcode to allow better optimization).

However, static images haven't had the wide range of codecs (most formats are lossless proprietary files used by various image editors) and have been almost entirely relegated to five formats, SVG, BMP, PNG, JPEG and GIF for distribution. You may occasionally PSDs or EPS files, or photography formats like DNG or standard-free RAW, but those fall into the same category as video codecs like ProRez, DNxHD, Cineform. These are intermediate formats that require specialized software to view/edit and converted when distributed beyond professional means (sans EPS).

We're starting to see future image formats like Google with WebP, and Apple with JPEG2000 and HEIC, and Safari allowing inline MP4s to be treated as images but for the past 10 years, much of the action in image compression has been trying to squeeze out ever last single byte out of the existing formats, almost entirely for JPEG and PNG (and SVG but that's a different story) A lot of the slow movement of web formats has to do with the W3c. It took Cisco buying and distributing the Mp4 patent for free to move MP4 to the accepted video formation for Microsoft, Apple, Google, and Mozilla. It may take some similar act of corporate benevolence to bring a successor to JPEG.

Interestingly though, there's a been a concerted effort to squeeze every bit of optimization out of the existing formats: JPEG has MOZJpeg, Guetzli, JPEGOptim, and Jpegtran. PNG has Zopfil, PNGOUT, OptiPNG, AdvPNG, PNGCrush. These all differ as some are encoders, and some are strictly optimizers but the end game is to extract the most out the formats which often involves trickery to exploit the compression. Both ImageOptim and Squash are GUI front ends that make use of these optimizations to create the best JPEG or PNG per kilobyte possible. These libraries do not come without a penalty, that being CPU cycles. These all can take minutes to execute on larger images, and the longest being Guetzli, a 8 MP image can take around 40 minutes to encode even a 5th generation Core i7. We're probably quickly approaching the end of the law of diminishing returns. If you're using Guetzli, I'd argue it's easier to provide alternative image formats (WebP / JPEG 2000) as opposed to burning hours encoding a hand full of images as you'll get better results for the people who can see them (Safari and Chrome users). The rest, however, are still viable.

PNG Compression tests

Settings used: ImageOptim (default)

  • Zopfli
  • PNGOUT
  • OptiPNG
  • AdvPNG
  • Strip PNG meta data
  • Lossless
  • Optimization Level: Insane
Imageoptim review

Squash 2

  • More Compressed (slower)

Test 1: Complex Webpage screenshot

  • Original:2.3MB (2,298,405 bytes)
  • ImageOptim:1.7MB (1,685,034 bytes)
  • Squash:1.7MB (1,663,095 bytes)

Kaleidoscope Show differences results: >No differences

Winner: Squash
Squash Savings over ImageOptim: 21,939 bytes (21.9K), 1.3%

Test 2: Simple Webpage screenshot

  • Original:33K (33,173 bytes)
  • ImageOptim: 18k (18,538 bytes)
  • Squash: 18k (18,538 bytes)

Winner: Tie

Kaleidoscope Show differences results: No differences

Neither of these is terribly surprising, Squash uses LibPNG and Zopfil, which are open source PNG optimizations. I'm a little surprised that Squash shaved off a few more K. To make sure this wasn't a fluke, I tested another screenshot, 2.9MB (2,880,886 bytes), again Squash 2 won, (1.1 MB) 1,116,796 to (1.1 MB) 1,140,793, for a savings of 23,997 bytes (24k). On very large PNGs, Squash 2 has the advantage. I checking PNGCrush, brought it down 1,126,420 bytes.

Test 3: Large Photograph

ImageOptim
  • Original: 10.4 MB,(10,403,651 bytes)
  • ImageOptim: 6 MB (5,927,713) bytes)
  • Squash: 5.6 MB (5,597,048 bytes

Kaleidoscope Show differences results: No Differences

Winner: Squash

This last test weighs in the most for the favor of Squash, 330,665 bytes is significant, even if only a 6% difference

The Results...

While hardly the epitome of comprehensive testing, Squash does provide slightly better PNG compression. That said, ImageOptim is quite good for the sticker price of free. Squash 2 is part of SetApp collection or $15 stand alone. Squash isn't as accomplished in JPEG optimization as ImageOptim but seems to be best PNG GUI utility for OS X. It's surprising too, as ImageOptim offers more options for optimization and the same optimization libraries. You can't really go wrong using either utility.

Mini Review of Squash

Squash is essentially a drag and drop no brainer utility, drag images in and Squash does the best. If you've used ImageOptim then you're familiar with it. The big differences between ImageOptim and Squash are mostly cosmetic as both do the same operation. Squash appears to be no faster than ImageOptim nor does it have has as many options. The UI does provide a goofy animation and annoying sound (I killed the sound effects immediately).

Where Squash won at PNGs, it lost out on lossless JPEG compression. Test routinely showed that ImageOptim shaved off on average about 5% more off JPEGs although individual tests differed wildly.

Squash 2 is a minimalist utility through and through. Drag images in and it outputs compressed ones. Quite possibly the best thing Squash offers over ImageOptim is one of the most simple, it allows you to create new versions of the file appended with a suffix. ImageOptim overwrites images which can be undesirable.

Take the pain out of building site search with the Algolia hosted API. Start free now!

I’m forever trying to make my local image workflow easier. I work with images as part of blog posts, images as part of sites I’m working on, images headed to social media… images everywhere. Almost always headed to the web. If we’re taught one thing about images and the web, it’s that they should be optimized.

For me, that means dragging every single image onto ImageOptim before using it. Monotonous repetitive tasks are fertile ground for computerization, so let’s computerize it.

The Desktop is my staging area

It’s just how I work. Things I’m actively using go on the Desktop. I do whatever I’m doing with them, then move them away. I keep it pretty tidy. Images are one of the most common things that end up there. Perhaps it’s a screenshot that needs to get resized, then optimized, then uploaded somewhere, then deleted.

The Desktop is a convenient place, for me, for all that to happen.

Imageoptim For Windows

Making any image on the Desktop automatically optimized

What if we didn’t need to optimize images because any image that was on the Desktop was automatically optimized? That’s what we’re shooting for here.

One way to approach this would be to set up a Grunt/Gulp/Webpack/Whatever watch task to watch the Desktop. Then if an image file appears there, run an image optimization task. A lot of us probably already do this with the web projects we work on. This wouldn’t be much different.

Imageoptim Online

Except… that we’d need to gulp watch (or whatever) from the command line every time we restarted. I bet there is some trickery to avoid that. Like putting the command into `~/.bash_profile` or something. I didn’t go down that road, though, because…

Enter Hazel

A number of recommendations from folks turned me onto Hazel. It’s basically a watch task for macOS, with a UI to set up all the stuff you want it to do. For example, you can watch your Downloads folder, and if the type of file is a Movie, you can automatically move it to the Movies folder. Cool.

That makes what we want to do real easy. We watch the Desktop folder and if the kind of file is an Image, open it in ImageOptim.

Simple, indeed

This is a pretty simple and obvious thing that I could have done years ago. That’s why I’m blogging it, I suppose. It’s a simple thing that has helped me a ton and might help you. Most importantly, I’ve actually stuck with it. Sometimes I try out some workflow optimization and it doesn’t stick. This has.