How to pick graphics from Mac applications
Every now and then I want to illustrate the way my Macintosh applications work by using their graphics. In the old days I used the old ⌘ -⇡- 4 trick to make a screen shot and then opened an image processor like Macromedia Fireworks to clean it up. However, there is a shortcut to the original images in Mac OS X, using the Terminal or just a plain web browser to display you the Contents of your applications.
Using Terminal.app
Terminal has been integrated into the very first versions of Mac OS X. It was a kind reward from Apple Inc. for all the efforts that UNIX freaks put into the voluntary development of Darwin which forms the base of Macintosh OS X. You can find it in the Applications folder in the subfolder Utilities. Open it and navigate to the applications folder. If you're unfamiliar to UNIX commands, here is an example below:
The moment you open the program, you will meet a screen message resembling to the below one:
Last login: Wed Nov 21 22:26:20 on consoleEriks-monster-iMac:~ erikthau-knudsen$
The second line in the above
text explains that you are operating on a computer named Eriks-monster-iMac
and that you are in a folder belonging to the user itself (depicted
with the tilde ~
symbol), i.e. who is logged in. Also it tells the user's nickname, in
this case my erikthau-knudsen
Enter the following: cd
/Applications
and press
Carriage Return. The command cd
is an abbreviation of change
directory
and in this case, it brings you to the Applications folder of your
computer. The output should be:
Then type the command ls
for list
directory and press
carriage return (⏎). The output should be something like the
below list:
Address
Book.app AppleScript Automator.app Calculator.app Chess.app DVD Player.app Dashboard.app Dictionary.app Expose.app Firefox.app Font Book.app Front Row.app GarageBand.app Image Capture.app iChat.app iDVD.app Mail.app iPhoto.app NeoOffice.app |
Opera.app Photo Booth.app Preview.app QuickTime Player.app Safari.app SeaMonkey.app Spaces.app Stickies.app System Preferences.app TextEdit.app Thunderbird.app Time Machine.app Utilities iCal.app iMovie.app iSync.app iTunes.app iWeb.app iWork '08 |
Eriks-monster-iMac:Applications erikthau-knudsen$ |
You recognise all your favorite
applications now surnamed .app
. In the finder, these suffixes are usually not displayed, but Terminal
does display the full names. Also, you see one folder, Utilities that
has no suffix. Viewing the contents of an application is just like
going on with the same procedure. Let's view Mail: type cd
Mail.app
⏎ and
then ls
⏎.
The outcome should be:
Contents
Eriks-monster-iMac:Mail.app erikthau-knudsen$
Meaning that inside the folder
Mail.app is another folder named Contents. Repeat the action cd
Contents
⏎ and
then ls
⏎.
Terminal will return you (in OS X.5):
CodeResources Info.plist MacOS MailTimeMachineHelper.app |
PkgInfo PlugIns Resources version.plist |
Eriks-monster-iMac:Contents erikthau-knudsen$ |
Explanations
- CodeResources
- a text file to be used by the Mail program.
- Info.plist
- an XML text file written in an Apple XML format called Property List 1.0. It contains instructions for the Mail program.
- MacOS
- a folder containing only one file — the program itself, in this case Mail.
- MailTimeMachineHelper.app
- another application to be used for enabling time machine facilities that were introduced in Mac OS X.5 Leopard.
- PkgInfo
- Package Info: a very short
file containing only one text string:
APPLemal
. - PlugIns
- A folder for plug-ins that
extend the program's features. As of version 3.1, this folder contains
the files
MailWebPlugIn.bundle
andToDoPlugIn.bundle
. - versions.plist
- Another XML file in the Property List 1.0 format, containing the data about the application build numbers and name.
- Resources
- This is the biggest folder
and also where we shall enter later on. The total size of Mail.app
is 286.5 MB, and the Resources folder alone contains 276.7 MB. The
Resources are basically localisations folders (English, Danish, German,
Chinese, etc., each amounting between 15.1 MB and 15.5 MB),
image files, sound files, and a few other ones, like Property Lists and
Cascading Stylesheets (
.css
). Localisations (i.e., language files) total about 268 MB. '
Proceed to the Resources folder
using the cd
and ls
commands. The list is very extensive because it holds a total of 351
items and thus will not be reproduced here. Most image files are pretty
small, even when written in TIFF.
Versions of Terminal prior to the one in Mac OS X.5 (Terminal 2.0
[237]) allowed you to open
the files using the command open
[file name]
, but at least the
above explanation has explained how to
locate the image files of an application in Mac OS X.
Using a WWW browser
Since we've already concluded
that an .app
file is, in fact, a folder, we can navigate to it, as long as we go
beyond the path to the file itself. So open a browser window (not Safari, which I will
deal with later). Type the following in the address field (or
Copy-and-Paste):
file://localhost/Applications/Mail.app/Contents/
You would then see the following (in Opera 9.24 [da-DK localisation]):
Clicking Resources
should bring you even further:
Click to view an image file, but remember that you'll have to obey to the specifics of your WWW browser. Most of them can't display TIFF files, usually only GIF, JPG, PNG, BMP (bitmap), and some varieties of Windows Icon (.ico) files (as well as SVG files, provided that you install an Adobe SVG plug-in). A browser like Opera will, instead it will download the image to your harddisk.
And here is some fun stuff: It works in Classic Macintosh OS surroundings too! The beginning of the URL may be different, so you will have to find out about the annotation principles of the particular browser when working in, eg. Macintosh OS 9, but for the rest, the /Program name/Contents/. is enough to achieve the above results, using the principles of Apple's Personal Web Finder.
Chances are that the principles in this are totally platform independent, i.e., you should be able to access the same files in the .app folders also in Windows, Linux, Symbian OS, etc., provided, of course, you use the media or network protocol appropriate for your system. TCP/IP is ok.
Using Safari
Apple's own WWW browser Safari is so interwoven with the Macintosh OS X that it behaves somewhat
different, and, in this case, more beneficial. In the address field, entering
file://localhost/Applications/Mail.app/Contents/
will bring you to the Finder. e.g.:
Once you're in the Finder, you're freer to do almost anything to the file. Mac OS X.4 (Tiger) and later are even able to display the TIFF files in thumbnail windows and icons, see below:
In conclusion, Apple's Safari
is a very powerful tool to hack into existing applications. Many Apple
proprietary files can be hacked similar ways, e.g., Address Book (.abbu
),
iCal (.icbu
),
Key (.key
).
The procedure is almost the same:
file://localhost/Users/
your user name here/... file path .../ file name/Contents/
Good luck seeing the contents of your files. You will be surprised to learn what really takes up all the space of your files.
Erik Thau-Knudsen
2007-11-23