Re: Extracting QuickLook Preview from a .graffle file
Wim Lewis <[email protected]>
| Newsgroups | gmane.comp.graphics.omnigraffle.user |
|---|---|
| Message-ID | <[email protected]> |
On Jan 31, 2010, at 12:38 AM, Niko Matsakis wrote: > I am writing a tool and would like to extract the Quicklook Preview (not thumbnail) from .graffle files. Since there is no public interface to extract QL Previews in general (only to run the QLPreviewPanel), I was thinking of hacking something up to extract the required image from the .graffle file directly. I see that .graffle files are gzipped plist files and that there is a key QuickLookPreview which seems to contain base64 data or something like that (at least for Omnigraffle 5 files). > > Can someone give me a hint of how to extract this data? It is an NSCoded version of an NSImage or something like that? Yup, it's simply a <data> element holding a PDF document. (For bundle-type Graffle documents, the quicklook preview image is stored in the file QuickLook/Preview.pdf --- same bytes, different place.) Some random notes: - The plist can be gzipped, bzipped, or not compressed at all (at the user's option). In either compressed case, the compression is compatible with the corresponding command-line tool. - The user can turn off the quicklook preview to save space, so don't absolutely rely on it being there. - The thumbnail is done similarly, except it's a TIFF image. - We don't want to discourage people from doing interesting things with Graffle files, but we reserve the right to change our file format at any time without notice yadda yadda yadda. :) Wim Lewis / [email protected]