September 10, 2006 at 10:21 PM by Dr. Drang
The reports I write for work usually include several photographs. I write the reports in Markdown, convert the text to LaTeX using MultiMarkdown, and convert that into a PDF using
pdflatex. I’ve been planning for months to write a detailed post—or set of posts—on how I integrate all these tools to make my report-writing relatively simple and painless, but today I’ll just offer a simple Automator plugin I made to keep the PDF file size down.
The photos in my reports are typically taken by me with a digital camera. They’re usually 1-3 MB JPEGs, way more resolution than needed for a 3-4 inch photo in a report. Before today, I just included the full-sized photos in the report because it was the easy thing to do. It made the PDF of the report pretty big—tens of MB, usually—but since my clients usually want paper copies rather than computer files, the file size didn’t matter much.
The waste of space did bother me, though, so today I fired up Automator and created a Finder plugin that would cut down the size of photos before including them in the report. The workflow window looks like this:
You can click on it to see it full-sized. The “Get Selected Finder Items” action is in the Finder library, and the “Scale Images” action is in the Preview library.
I named it “Halve,” because it scales the image by 50% and saved it as a Finder plugin. Now I select the photos I want to include in my report, copy them into the report’s folder, and run the Halve command on those copies by
- selecting them in the Finder;
- right-clicking (control-clicking) on one of them; and
- choosing the Halve item from the Automator submenu.
Now these half-sized photos are what gets included in the report PDF and the file size is way down. I had expected a reduction to about 25% of the original file size (because the reduced photos contain one-quarter the number of pixels), but the savings is a bit more. The report I wrote today weighed in at over 25 MB with the original photos, but was less than 5 MB with the halved photos. Small enough to email comfortably if the client wants it that way, but with no visible loss of quality in the printed copy. And, since I was already copying the photos into the report folder so
pdflatex could find them, very little change in how I work.