Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, Swift, BASIC, and whatever else I happen to feel like hacking at.

Quality reduced file size in Mac OS X Preview

Jerry Stratton, January 29, 2006

ColorSync Utility Icon: ColorSync Utility Icon on Quality reduced file size in Mac OS X Preview

ColorSync makes Quartz filters.

If you use the print to PDF feature in Mac OS X, you have probably noticed that it can create some really large PDF files. This is fine as long as you are copying them to CD or DVD, but if you’re putting them on the web or sending them through e-mail, they can really cause havoc on both ends.

If you open the PDF in Preview, you can reduce the file size by doing a “Save As...” and choosing, appropriately, Reduce File Size from the Quartz Filter menu. Often, that will be fine. But the way that it reduces the file size is by saving all images as JPEGs of middle quality. Sometimes that quality will not be enough.

I just finished a Persistence of Vision tutorial, and because it’s a tutorial on using a 3-D raytracer it was full of images. The PDF file was nearly 20 megabytes. After saving it with Reduce File Size, it was down to under one megabyte... but the quality of the images was so bad that they didn’t serve to illustrate the concepts in the text.

It was obvious what was happening, and I knew that when saving JPEG files you are allowed to trade off low file size with increased quality. But there was no slider available in the Quartz Filter menu to increase the quality of the image.

The answer, it turns out, is in ColorSync Utility in the Utilities folder off of the Applications folder. ColorSync Utility can create new Quartz filters. Open up ColorSync Utility and switch to the “Filters” pane. This will list all of the filters that you currently have available.

  1. In the lower left, click on the “+” button. This creates a new filter.
  2. Give the filter a name, and press return.
  3. To the right of the filter’s name, choose the down arrow. A menu will pop up.
  4. From the pop-up menu, choose “Add Image Effects Component”, and from that menu choose “Image Compression”.
  5. Adjust the image compression Mode to JPEG.
  6. Adjust the image compression quality however you prefer.
  7. The next time you use Preview to “Save As...”, you'll have a new option under Quartz filters.
Quartz Filters in ColorSync Utility: Quartz Filters in ColorSync Utility on Quality reduced file size in Mac OS X Preview

I’ve created a Reduced File Size High Quality and Mid-Quality as custom Quartz filters.

With the quality slider three quarters over, the file size dropped to 7.7 megabytes. This is quite a bit larger than with the slider half-way over, but not nearly the 20 megabytes of the original. And quality became a lot higher.

Filter while printing

You can also filter while printing, avoiding the need to re-open the PDF in Preview. When you go to print, pull down the menu just below “Presets” that usually says “Copies & Pages”. Choose “ColorSync”. Then choose the Quartz filter that you want. Once you’ve chosen it, you can also pull down the Presets menu and do a “Save As...” to remember these settings.

May 21, 2025: Reduce File Size Update for Sequoia
Reduce File Size (Sequoia): Reduce File Size does still work—if I hit all three potential options.; PDF; macOS Preview

To get the built-in Reduce File Size Quartz Filter to reduce file size, I also have to check “Optimize images for screen”.

One of the most popular pages on my site is how to create a Reduce File Size Quartz filter. Sadly, while it appears to be still recommended by many people, it hasn’t worked for me for a long time. But I recently decided to write a color cookbook and I wanted to make the PDF available for download.

I don’t like having multiple sources for multiple destinations. That way lies madness. I want the same source to provide for different destinations. But the file destined for print1, because this book is focused as much on the images as on the recipes, was large even for modern downloads. If it turns out to be a tenth as popular as Quality Reduced File Size I don’t need people downloading hundreds of copies of a 34 megabyte file every day.

So I decided it was time to take a look at why Quartz filters stopped working so long ago, or at least how to get them working again. To be honest, I’m still not sure what’s going on. But I was able to get the stock Reduce File Size filter working again.

The executive summary is that I have to turn on Optimize images for screen if I want Reduce File Size to actually reduce file size. Read further for what I discovered in greater detail, as well as advice if you have multiple copies of your aging custom quartz filters.

First, Quartz filters no longer show up at all on Print, even from Preview. I have to open the PDF in Preview and choose File:Export to get the list of filters. Even then, though, if I just choose “Reduce File Size”, the resulting file is always exactly the same size as the starting file.

Apple’s help page says that, to reduce file size, you have to:

Do one or more of the following:

  • Compress PDF graphics to presentation quality: Select the “Optimize images for screen” checkbox.
  • Convert all graphics to JPEG format: Select the “Save images as JPEG” checkbox.
February 16, 2012: Quality compressed PDFs in Mac OS X Lion
Lion Preview Export: Exporting a PDF using a Quartz filter in Lion.; macOS tricks; Mac OS X tricks; PDF

Save As… has been renamed to Export in Lion’s Preview.

I’ve verified that these instructions for using Preview to compress PDFs continue to work in Mac OS X Lion.

One minor problem is that the last paragraph—that you can even “filter while printing” without using Preview is no longer true, but it wasn’t true in Snow Leopard either. I can’t remember if it worked in Leopard or if it last worked in Tiger.

I took some screenshots but haven’t included them here; they really are exactly the same as when I wrote those instructions. The only real difference is that in Lion, “Save As…” has been renamed “Export…”.

The main issue, as Vinnie pointed out in the comments is that after you create the filter it doesn’t automatically show up in Preview’s list of Quartz filters. Either ColorSync or Preview is working from the wrong folder.

ColorSync saves your filters in your personal “Filters” folder under your “Library”. But Preview looks in “PDF Services” for the filters. Copy or move the new filter from your Library’s “Filters” folder to your Library’s “PDF Services” folder. If you want to make the filter available to everyone who uses your Mac, put it in the main “/Library/PDF Services” folder instead. Note that Lion has hidden the Library folder, so you’ll need to use the “Go” menu and “Go to folder…” to go to your “Library” folder, and also to go to the “/Library”, depending on whether you are making it available for yourself or for everyone.

Further note that Preview in Lion, but not Snow Leopard, (sometimes? always?) has problems finding Quartz filters inside your own PDF Services folder, so you may have to always put it in the main Library’s PDF Services folder instead. Oddly, the Print dialog doesn’t have any problem with this, only Preview.

This will work in Snow Leopard as well—and will sort of bring back the ability to use the filter directly while printing to PDF. The filters will be available under the PDF menu; on choosing a Quartz filter, it will immediately save the current document as a PDF. The Mac doesn’t seem to ask for a filename, and just deposits it on the Desktop, though some of that may have to do with settings on my computer.

  1. <- Simple POV
  2. Hijacking iTunes ->