Story   Photographer   Editor   Student/Intern   Assistant   Job/Item

 Front Page
 Member Index
 Latest Headlines
 Special Features
 'Fun Pix'
 Message Board
 Educate Yourself
 Equipment Profiles
 Classified Ads
 Monthly Clip Contest
 Annual Contest
 Current Issue
 Back Issues
 Members Area
 "The Guide"
About Us:
 About SportsShooter
 Contact Us
 Terms & Conditions

Sign in:
Members log in here with your user name and password to access the your admin page and other special features.



|| News Item: Posted 2008-04-01

Ask Sports Shooter: Demystifying Photo Mechanic's Code Replacement
Kirk Baker of Camera Bits explains how to speed up your workflow.

By Kirk Baker, Camera Bits

Photo by

Photo Mechanic
(Editor's Note: Each month Sports Shooter will take a question sent in or a topic from the message board and get an answer. At the recent Sports Shooter Academy V, one of the most discussed items during the Digital Workflow Class was the use of Photo Mechanic's code replacement. Sports Shooter asked Camera Bit's Kirk Baker to explain this cool, time-saving feature.)

As an engineer I don't often have the chance to meet face to face with the Photographers who use Photo Mechanic, but when I do, they usually ask "how can I speed up my workflow?" Besides simple things like locking the best photos on the camera when you get a chance and using Ingest to download the locked photos, the things that really speed up your workflow are intelligent usage of the IPTC Stationery Pad on Ingest and the use of Code Replacement.

Most Photo Mechanic users understand IPTC Stationery and how it can be used. On the other hand Code Replacement is very simple but can be hard to understand at first. Code Replacement was a user requested feature that took some time to explain via our forums, but once I understood what the user wanted to do, it was quite obvious how powerful it could be. Code Replacement is basically a shorthand system that you can use to speed up your captioning.

Here is how Code Replacement works: first you prepare a simple text file containing two "columns", the first column being the "Code" and the second column being the "Replacement". The two columns are separated by a 'tab' character. The format of the text file is Unicode UTF-8. This allows codes and replacements to be written in any language supported by Unicode. There are many text editors available that can read, write, and edit UTF-8 text files. Two well-known editors that are free are TextWrangler for Mac OS X, and Notepad2.exe for Windows.

(A Google search will quickly find sources to download these applications.) Once you have written your Code Replacement text file, you use the "Set Code Replacements..." command on the Edit menu and then use the dialog to load your newly created text file. Then you confirm the dialog and you can now use your Codes to trigger Replacements in your captions.

Let's look at this in greater detail-- we'll create a Code Replacement text file for an NBA basketball game between the Phoenix Suns and the New Jersey Nets. First we create an empty text document with our text editor. Then we use the Internet to access the rosters for both teams. Next we create a 'mnemonic' or a memory aid to help us remember our codes.

Often the simplest mnemonic is just to use an abbreviation of the team name, followed by the player number. We'll use 's' for Phoenix Suns and 'n' for the New Jersey Nets. Start with the roster for the Phoenix Suns. (You can view the roster at On the website you'll see the player number followed by the player's name. Let's enter some names. Remember to type the 'tab' key after your codes and then type in your replacement text, and then type the 'enter' or 'return' key on your keyboard to start the next code:

s10 Leandro Barbosa
s19 Raja Bell
s3 Boris Diaw
s2 Gordon Giricek
s33 Grant Hill
s4 Sean Marks
s13 Steve Nash
s32 Shaquille O'Neal
s52 Eric Piatkowski
s54 Brian Skinner
s1 Amare Stoudemire
s8 D.J. Strawberry
s29 Alando Tucker

Now let's enter the roster from the New Jersey Nets. (You can view the roster at The layout of this roster is very similar to the Suns' roster. Add the Nets roster right after the last Suns player:

n13 Maurice Ager
n10 Darrell Armstrong
n2 Josh Boone
n15 Vince Carter
n14 DeSagana Diop
n34 Devin Harris
n44 Trenton Hassell
n24 Richard Jefferson
n12 Nenad Krstic
n7 Bostjan Nachbar
n6 Stromile Swift
n22 Keith Van Horn
n1 Marcus Williams
n51 Sean Williams

Now save out the file in UTF-8 and load it into Photo Mechanic by using the "Set Code Replacements..." command on the Edit menu. Click on the "Add..." button and use the file picker dialog to find the text file you just saved. Then before you confirm the Code Replacement dialog, look at the text field in the lower left corner of the dialog. It is titled "Delimiter character:" and the default value is the backslash character but can be virtually any character you wish. We'll stick with '\' for this tutorial. Click on the OK button to close and confirm the dialog. Next we'll use the IPTC Stationery Pad dialog and practice using Code Replacement interactively.

Open up the IPTC Stationery Pad dialog and put your cursor in the Caption field. Type a backslash ('\') followed by 's10' and then another backslash ('\') and you'll see that your Code has been replaced with "Leandro Barbosa". If you didn't see that result, then perhaps you took me too literally and entered all of those quotes. All you want to enter is this:


...and you'll see this in return:

Leandro Barbosa

Try it some more with some of your other codes. Code Replacement can be very helpful especially with hard to spell names like "Nenad Krstic" and "Bostjan Nachbar". You'll never misspell those names again. Just get them right one time in your Code Replacement file.

Cancel your IPTC Stationery Pad and open up a Contact Sheet of photos from the Suns/Nets game. Click on the 'i' button to bring up the IPTC Info dialog of one of your photos. Now hopefully you can see the numbers of the players making the play by looking at the thumbnail in the IPTC Info dialog. You can click and hold the mouse on the thumbnail to show a larger version of the photo. Let's say that #19 of the Suns is blocking a shot by #44 of the Nets. We don't even need to know the player's names thanks to Code Replacement. Enter the following in the Caption field:

\p19\ blocks a shot by \n44\ in the first quarter of the Suns vs. Nets game.

the result will be:

Raja Bell blocks a shot by Trenton Hassell in the first quarter of the Suns vs. Nets game.

This is just a simple example to get you started with Code Replacement. You can do more advanced things like have alternate Codes that enter even more details for you, like team names, positions and the player's number like so:

p19x Raja Bell #19, Guard for the Phoenix Suns
n44x Trenton Hassell #44, Forward for the New Jersey Nets

Now if we revisit the same photo again, we can enter the following in the Caption field:

\p19x\ blocks a shot by \n44x\ in the first quarter of the Suns vs. Nets game.

and have this as the result:

Raja Bell #19, Guard for the Phoenix Suns blocks a shot by Trenton Hassell #44, Forward for the New Jersey Nets in the first quarter of the Suns vs. Nets game.

The use of Code Replacement can really speed up your captioning and get your photos delivered faster than ever. member Mike Stone has created some scripts that can make generating your Code Replacement files a snap. His tools are really useful and will really make your life easier. Check out the NBA script here:

Here is an excerpt from the Code Replacements generated by Mike's NBA script for our two teams:

p Phoenix Suns
p10 Leandro Barbosa
pp10 guard Leandro Barbosa
tp10 Phoenix Suns' Leandro Barbosa
tpp10 Phoenix Suns guard Leandro Barbosa
p10n Leandro Barbosa #10
pp10n guard Leandro Barbosa #10
tp10n Phoenix Suns' Leandro Barbosa #10
tpp10n Phoenix Suns guard Leandro Barbosa #10
n New Jersey Nets
n13 Maurice Ager
pn13 guard Maurice Ager
tn13 New Jersey Nets' Maurice Ager
tpn13 New Jersey Nets guard Maurice Ager
n13n Maurice Ager #13
pn13n guard Maurice Ager #13
tn13n New Jersey Nets' Maurice Ager #13
tpn13n New Jersey Nets guard Maurice Ager #13

If you take a little time to study the Codes and the Replacements, you'll see how rich you can make your Captions and how quickly you can enter them thanks to Photo Mechanic and its Code Replacement feature. I hope this tutorial was helpful and you'll find that you can use Code Replacement to increase the accuracy of your Captions and speed up the creation of them as well.

Camera Bits Forums: thread on Code Replacement:

Another thread on Code Replacement:

Mike Stone's Code Replacement Extract tools:

(Kirk Baker is a software engineer that helped design and develop Camera Bits' Photo Mechanic.)

Contents copyright 2022, Do not republish without permission.
Copyright 2022,