This article originally appeared in TidBITS on 2016-05-18 at 4:05 p.m.
The permanent URL for this article is: http://tidbits.com/article/16492
Include images: Off

The Power of Preview: Converting Images and Exporting PDFs

by Josh Centers and Adam C. Engst

In our exploration of Preview, OS X’s built-in image and PDF powerhouse, we’ve walked you through getting files into Preview (see “The Power of Preview: Pulling Files into Preview [1],” 25 February 2016) all the way to advanced editing techniques (see “The Power of Preview: Advanced Editing Techniques [2],” 25 April 2016). As our series draws to a close, it’s time to end it in the natural place: saving and exporting your files.

Since Preview uses the Modern Document Model (see “The Very Model of a Modern Mountain Lion Document [3],” 7 August 2012), it saves existing files automatically as you edit. Likewise, Preview supports Resume, so if you quit Preview without saving, or Preview closes due to a crash or power outage, you won’t lose your work.

But that’s all Mac 101. More interesting is how Preview can convert your files into different formats. You can even export a PDF as an image or vice versa! That can be handy if, for instance, you have a one-page PDF flyer that you want to convert to a PNG or JPEG so it can be posted more easily on Facebook.

Three commands in Preview’s File menu help you export your files:

There’s also a fourth option, Save As, which doesn’t appear by default. Hold down the Option key to change the Duplicate command to Save As. But with one minor exception that we’ll cover later, Save As does the same thing as Export, so there’s no need to bother, unless you’re just working out of habit. If you prefer Save As to Duplicate, check out “Put Save As Back on the File Menu [4]” (30 November 2015).

Converting Image Formats -- We assume that you understand the basics of naming, saving, and tagging files, so we’ll focus on the interesting bit: format selection. The Export dialog’s Format pop-up menu shows only 6 file formats by default, but if you Option-click it, Preview displays 19 choices!

This conversion capability is handy, because if you have a JPEG and need a PNG, all you have to do is open the JPEG in Preview, choose File > Export, change the Format pop-up menu to PNG (note the resulting file size estimate), and click Save.

But if you don’t already know that you need a PNG, which format should you pick? It depends on your intended destination for the file. We’ll look at PDF next, but the four most common image formats are:

So, if you’re unsure, which format should you use? If the image is photographic, JPEG provides the best combination of quality and reduced file size. On the other hand, if it’s a computer-generated graphic with large areas of uniform color, like most screenshots, or if transparency is needed, stick with PNG. TIFF is useful primarily in the print publishing world; for instance, a publisher may require that screenshots for a book be in TIFF rather than PNG for color workflow reasons. Also, use TIFF if you will need to edit with layers in an app like Photoshop.

What about all those other image formats? For the most part, they’re old, uncommon, or both, at least in the Mac world. The two exceptions are Photoshop and QuickTime Movie, which are plenty common, but unlikely to be useful within Preview. Saving a file in Photoshop format does mean that Photoshop can open it natively, but as far as we can see, there’s no advantage over PNG in that regard. And we can’t figure out what file format you can open in Preview that you could later save using QuickTime Movie; animated GIFs seemed the most likely, but they can’t be saved as QuickTime movies. If you’d like to read up on these other formats, here’s a full list, with informative links:

Despite the length of that list, there are many more graphic formats out there. If you run across a file that you can’t open, or if you need to save an image in a format that Preview doesn’t support, turn to Lemke Software’s venerable GraphicConverter [27], which can import approximately 200 file formats and export in roughly 80 formats.

Exporting to PDF: Quartz Filters -- Entire books have been written about Portable Document Format (like “PDF Hacks [28],” “PDF Explained [29],” and “Developing with PDF [30],” all from O’Reilly Media). Originally created by Adobe but an open ISO standard since 2008, PDF is one of the tech world’s most useful file formats. In the simplest terms, PDF represents the text and graphics of a printed document in digital form. The most common usage of PDF is in printing and publication, with examples ranging from government forms to Take Control ebooks. But PDF is incredibly flexible — OS X’s Quartz rendering engine uses PDF internally, which is why it’s so easy to export things as PDF in OS X.

Preview’s Export dialog provides two extra options when exporting PDFs: Quartz filters and encryption. Quartz filters modify the exported PDF in various ways, either adjusting the look of the document or tweaking its format under the hood.

In the first category, you’ll find Quartz filters for Black & White, Blue Tone, Gray Tone, Lightness Decrease, Lightness Increase, and Sepia Tone. The tonal adjustments do what you’d expect, making the image black-and-white or turning all colors into shades of blue, gray, or sepia.

[image link] [31]

The two lightness filters apply to all colors as well, so their effects are relatively subtle in photos, but can make a large difference to colored text.

[image link] [32]

When it comes to fiddling with the document format, Apple provides Quartz filters for Create Generic PDFX-3 Document and Reduce File Size. PDFX-3 is a subset of PDF with printing-related requirements that facilitate a color-managed workflow. Honestly, if you need a color-managed workflow, you should be (or already are) using Adobe Acrobat Pro.

Reduce File Size is alluring, but beware if you have images other than photos in your document. When you use Reduce File Size, Preview uses lossy compression to reduce the quality of every image in the document, making non-photos notably fuzzy. Photos see a quality reduction too, but the effects are less noticeable. Happily, Reduce File Size has improved radically from earlier versions of Preview, which also deleted useful metadata like a PDF’s table of contents.

[image link] [33]

Exporting to PDF: Encryption -- Preview’s Encrypt checkbox may be more useful to you. If you’re sharing a PDF that contains confidential information, you can reduce the chances that it will be read more widely by encrypting the document, after which a password is necessary to display it.

In PDF parlance, the password created by Preview’s Encrypt checkbox is a “document open” or “user” password, as opposed to a “permissions” or “owner” password, which restricts editing and printing of the document. More on how to set a permissions password in a moment; you can’t do it from the Export dialog.

Preview offers no facility for entering the permissions password to override previously set restrictions, with one exception. If you open a PDF encrypted with a permissions password that prevents changes, and then try to use Preview’s File > Export or Export as PDF commands, you’ll be prompted for the permissions password. That is, unfortunately, false security because any change in a permissions-protected PDF causes Preview to make a copy that you can save. Plus, while Export may ask for a password, File > Save As does not. Oops.

To encrypt a PDF with a document open password, choose File > Export, select the Encrypt checkbox, enter a password, and then enter the password again to confirm it. From then on, when anyone — including you — tries to open the encrypted PDF, in any PDF-savvy app, they’ll be prompted for the password.

[image link] [34]

As far as we’re aware, as long as the document open password is relatively strong, there’s no way to brute force it. (If you use a weak password, a dictionary attack may be able to crack it.) You may run across utilities or Internet services like PDFUnlock [35] that claim to be able to remove passwords from PDFs. They’re talking about the permissions password, not the document open password, and thus can’t do anything for you that you can’t accomplish more efficiently in Preview itself.

What if you want to remove a document open password from an encrypted PDF? As long as you know the password, it’s simple — just open the PDF, enter the password, and then use Export to save it again, without selecting the Encrypt checkbox. This technique might be useful if a document was confidential for a time, but no longer needs to be.

Printing to PDF: More Encryption -- As previously mentioned, you can “print” any document from any app to a PDF. This is a system-wide feature in OS X, thanks to Quartz’s foundations in PDF, and is tremendously useful for testing what a print job will look like before sending it to your printer or for saving a Web page as a PDF.

But why print to a PDF from Preview, which has built-in PDF export capabilities? For one thing, it offers more metadata and security options than Preview’s export feature, but it also solves a common Preview problem.

Since we began this series, several readers have written in with the same issue: you mark up a document in Preview, save it, send it to a collaborator, and they don’t see your annotations. We don’t know why this might happen — PDF is a standard, but that doesn’t mean every app implements it correctly — but printing to PDF appears to cause the annotations to show up properly in most cases.

To export a PDF in this way, choose File > Print. In the resulting dialog, click the PDF pop-up menu in the lower left and choose Save as PDF. (Further down in that menu, you may see a bunch of printing workflows that various apps install for you. They make it easy, for instance, to print a document to PDF and send it with Messages in one step.)

[image link] [36]

In the Save dialog that appears next, you’ll notice a few additional options. You can enter not just the filename, but also title, author, subject, and keyword metadata. This standard PDF metadata becomes visible in Preview’s Inspector window (choose Tools > Show Inspector or press Command-I), in other PDF apps, and even in the Finder’s Get Info dialog.

[image link] [37]

But there’s more! Click Security Options, and you can set both the document open and the permissions passwords for the PDF, and choose whether the permissions password will restrict changes, printing, or both.

[image link] [38]

Preview in the Rearview Mirror -- This article wraps up our series on Preview. We hope you’ve enjoyed it, and if you have more questions about Preview or tips to share, let us know. Who knows what additional features might lurk within Preview’s depths?

Finally, although we don’t have a schedule set yet, the response to this series has been so positive that we’re planning to start on a “Take Control of Preview” book.

[1]: http://tidbits.com/article/16284
[2]: http://tidbits.com/article/16423
[3]: http://tidbits.com/article/13187
[4]: http://tidbits.com/article/16114
[5]: https://en.wikipedia.org/wiki/Graphics_Interchange_Format
[6]: http://bits.blogs.nytimes.com/2013/05/23/battle-over-gif-pronunciation-erupts/?_r=0
[7]: http://en.wikipedia.org/wiki/JPEG?r=0
[8]: https://en.wikipedia.org/wiki/JPEG_2000
[9]: https://en.wikipedia.org/wiki/Portable_Network_Graphics
[10]: http://tidbits.com/resources/2016-05/Preview-PNG-vs-JPEG.png
[11]: http://tidbits.com/article/16423
[12]: https://en.wikipedia.org/wiki/Tagged_Image_File_Format
[13]: https://en.wikipedia.org/wiki/Adaptive_Scalable_Texture_Compression
[14]: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
[15]: https://en.wikipedia.org/wiki/JPEG_2000
[16]: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
[17]: https://en.wikipedia.org/wiki/BMP_file_format
[18]: https://en.wikipedia.org/wiki/ICO_(file_format)
[19]: https://en.wikipedia.org/wiki/OpenEXR
[20]: https://en.wikipedia.org/wiki/Netpbm_format
[21]: https://en.wikipedia.org/wiki/PVRTC
[22]: https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format
[23]: https://en.wikipedia.org/wiki/PostScript
[24]: https://en.wikipedia.org/wiki/QuickTime_File_Format
[25]: https://en.wikipedia.org/wiki/Silicon_Graphics_Image
[26]: https://en.wikipedia.org/wiki/Truevision_TGA
[27]: https://www.lemkesoft.de/en/products/graphicconverter/
[28]: http://www.amazon.com/dp/0596006551/?tag=tidbitselectro00
[29]: http://www.amazon.com/dp/1449327915/?tag=tidbitselectro00
[30]: http://www.amazon.com/dp/1449310028/?tag=tidbitselectro00
[31]: http://tidbits.com/resources/2016-05/Preview-sepia.png
[32]: http://tidbits.com/resources/2016-05/Preview-lightness-comparison.png
[33]: http://tidbits.com/resources/2016-05/Preview-reduced-size.png
[34]: http://tidbits.com/resources/2016-05/Preview-unlock-PDF.png
[35]: http://www.pdfunlock.com/
[36]: http://tidbits.com/resources/2016-05/Preview-Print-dialog.png
[37]: http://tidbits.com/resources/2016-05/Preview-PDF-print-options.png
[38]: http://tidbits.com/resources/2016-05/Preview-Print-to-PDF-security.png