Your prescription for increased productivity and profitability
Metadata is the information about a file that is “hidden” in its header. Many cameras add information about the photograph in its metadata when the picture is taken. Some of this information may include focal length, ISO Speed, Aperture, Shutter Speed, and even GPS information. Most designers make use of important metadata such as Capture Date and Modification Date which are also added to the metadata automatically.On top of the information recorded without intervention, there are some fields that designers should be interested in:
The responsibility of adding this information to image files usually falls on the person who is responsible for cropping, modifying, and saving the file (most likely in Photoshop). The extra chore of adding metadata information to an image is often met with some resistance because of workload. Even the argument that having metadata “saves time in the long run” falls on deaf ears. Often, the response might be something akin to “When one is up to their ankles in alligators, there is no time to drain the swamp.” Automating Metadata You may not be aware that you can write scripts for Photoshop using AppleScript, ExtendScript, and Visual Basic. Interestingly, Photoshop did not support AppleScript until version 7. Prior to this, a third-party plugin from MainEvent was required. Since then, Adobe’s support for scripting has grown with each release.
For users, however, most are familiar with setting up actions in Photoshop but scripts may be another matter. Scripts are much more efficient than actions in that they access the application’s code dictionary rather than manipulating the interface. Importantly, scripts support logic, so a script can test a condition and branch to code based on this state or condition. You might decide to become your Photoshop user’s best friend with a script that takes much of the work out of adding metadata to their files. In many ways, writing the code is quite similar to coding for InDesign.
Just to get you started, you might want to test out the following script with a folder in your home directory that has just a few images. Once you see how the script works, you may want to modify it to include additional information. And, of course, you will want to rewrite the getInfo handler so it returns all of the information you want the user to enter.
(*Expects image folder to be located in the user's home directory.*) property userName : "S Hopkins" property userTitle : "Photographer" property cRightNotice : "Copyright 2014, Shirley Hopkins, DTP Connection" property ownerURL : "yourscriptdoctor.com" set myDirectory to path to home folder from user domain set theFolder to choose folder with prompt "Select a folder of images" default location myDirectory set filePath to theFolder as string set fileList to list folder theFolder without invisibles tell application "Adobe Photoshop CC 2014" repeat with i from 1 to length of fileList set fileName to item i of fileList set imageRef to (filePath & fileName) open file imageRef showing dialogs never tell current document set docName to name tell info set author to userName set author position to userTitle set copyrighted to copyrighted work set copyright notice to cRightNotice set owner url to ownerURL with timeout of 500 seconds set userInfo to my getInfo(docName) end timeout copy userInfo to {docTitle, docCaption, docKeywords} set title to docTitle set caption to docCaption set keywords to docKeywords end tell --info save close end tell -- document end repeat end tell -- application (*You will need to create a user dialog to get the information you want from the user*) on getInfo(docName) set userResponse to display dialog "Enter caption" default answer "My caption here" buttons {" Cancel", "OK"} default button "OK" if button returned of userResponse is "OK" then set imgCaption to text returned of userResponse else set imgCaption to "" end if return {docName, imgCaption, {"One", "Two", "Three"}} end getInfo
Now that having a script for your user will make sure the necessary information will be written into image files, you can use the information in any number of automation workflows. The most common use is for adding a credit and caption to an image as part of the image being placed.
A handler that can be modified to return the credit and caption for a placed image follows. It expects a reference to the image placed and returns a string having both the credit and the caption. This could be modified to return whatever metadata your script might require.
on getImageMeta(imageRef) tell application "Adobe InDesign CC 2014" set linkRef to item link of imageRef set linkMeta to properties of link xmp of linkRef if author of linkMeta is not "" then set capStr to author of linkMeta & return set hasCredit to true end if set capStr to capStr & description of linkMeta end tell return capStr end getImageMeta
In a script for creating a multi-state object, you could use the image title and description of the metadata to add text to each state of the object. When creating a document that will be exported to HTML or ePub you will want to set up Object Export Options to generate alternate text using the file’s metadata (Title, Description, or other).
Not to be forgotten are the text variables you can set up for your InDesign documents. Many of these rely on the metadata found in an image file. Our next blog will look at some of the ways you can use text variables as part of an automated workflow.
If the idea of automating Photoshop has tweaked your interest, you will want to visit www.adobe.com/devnet/photoshop/scripting.html. There you will find links to the Photoshop CC Scripting Guide and references for working with all three scripting languages (whichever is your favorite).