Bill Bumgarner


pdf2png -- using Quartz to convert PDF to PNG

I am often taking screenshots on Mac OS X via the shortcuts that Steve describes.

And, like Steve, it bugged me that screenshots were written as PDF with no obvious means of converting them to PNG without going through Preview. At least, none that I'm aware of (which may mean nothing -- I have been known to miss the obvious).

It turns out to be rather easy. Panther includes Python bindings for Quartz and Quartz includes all the API necessary to do just about anything desired with PDF, PNG and other bitmap formats.

Here is a tiny python script that takes PDF files as arguments and converts each into one or more PNG images, one page per PNG file (with appropriate numbering scheme).

It works well enough for solving the problem of converting screen shots, but seems to generate rather trashy PNG files if processing anything other than PDF based bitmaps.

Comment on this post [ so far] ... more like this: [Mac OS X, PDF] ... topic exchange: [Mac OS X, PDF]