October 22, 2008

Per-layer metadata comes to Photoshop

Fair warning: this is likely to be a pretty nerd-tastic blog entry, and it’s the kind of thing most people will never know or care about.  Unless, that is, someone leverages it to do extremely cool, useful things.  Right now it’s kind of a toss-up.

 

In summary, Photoshop’s scripting system can read and write parameters (keywords, descriptions, etc.) for each layer, meaning you can more richly tag layers with info–something that’s highly valuable when moving PSDs downstream into other apps.  Adobe hasn’t yet leveraged this support to enable new features, but the support is in place for developers.  Read on for the details.


For many years Photoshop has supported metadata tagging on a per-document level.  Via the File Info interface or the Metadata panel in Bridge, you can edit things like a document’s copyright info, caption, etc.  Photoshop also automatically adds/modifies certain info (e.g. preserving camera parameters stored in EXIF data; generating and storing a global unique ID for each file).  All this info is applied to the whole document, not to the doc’s constituent pieces.

 

In Photoshop CS4, however, it’s possible to store metadata on a per-layer basis.  The Photoshop scripting system (which can now be controlled by Flash panels) can read and write any text data (keywords, descriptions, etc.–anything you can think of) for each layer.  Just like other properties that are stored for each layer (visibility, opacity, blending mode, etc.), per-layer metadata moves around with layers themselves.  You could, for example, attach a description to a layer, duplicate the layer, and have the description duplicated as well.

 

The feature came about partly in response to requests from our friends at Pixar.  Layered PSD files get consumed by their rendering pipeline, and they asked for a way to be able to tell which parts of files had been edited, and when.  Previously this was impossible: when Photoshop would save a file, it would update the modification date for the file as a whole.  Now it also tracks timestamp info for each layer, meaning that if only 3 out of 50 layers in a file have changed, a downstream app can pull out and re-render just those 3 layers.

 

That’s all good (and automatic; no user participation required), but we thought it would be useful to make the system more general.

 

Fundamentally, Photoshop files get used in a huge variety of applications and workflows (print, Flash authoring, motion graphics, DVD authoring, you name it), yet the Photoshop interface has no idea about the details.  Consequently there really hasn’t been a good way to capture workflow-specific intention inside Photoshop.  For example, how would you use a PSD to communicate that a certain layer is supposed to become a particular kind of movie clip in Flash, or a button rollover state in Encore?

 

People end up heavily overloading the few tools they’ve got–layer names, layer visibility, and nesting layers into folders/groups.  Naming conventions work up to a point, but they’re clumsy and fragile.  Wouldn’t it be better to have a panel that let you display & set parameters easily?  For example, a panel could contain checkboxes or radio buttons for the different rendering options that should be applied to layers.  Instead of trying to type codes for those parameters into each layer name, why not select a bunch of layers, then flip the appropriate checkboxes?

 

Okay, as you’ve read this far, I’ll reward you with some visuals:

 

  • This mockup depicts a Photoshop panel that displays the contents of a layer and makes it possible to set resizing coordinates for use in Flash or Flex.  Photoshop proper doesn’t have to know or care about what these parameters mean; it just has to let you specify a set of X/Y coordinates.  These coordinates can then be read downstream, when the file is consumed by Flash or Flex.
  • One of our summer interns coded up a sample panel (screenshot) that can read and write descriptions and comments on each layer.  The panel and its source code are part of the PS Panel Developer’s SDK, but I’ve also uploaded it here for convenience.  (Unzip the contents to your Adobe Photoshop CS4/Plug-Ins/Panels directory, then relaunch PS and look under Window->Extensions for the panel.) [Update: The CS4 version of the sample panel doesn't work in CS5, so please check out the CS5 version of the SDK. I'm told the updated version of the panel is in there.]

 

As noted above, the metadata written here sticks to a layer, just like any other layer parameter would.  Duplicate the layer and you duplicate its metadata; delete the layer and the metadata leaves, too.

 

Besides the automatic storing of timestamps for each layer, nothing else in the app leverages per-layer metadata–yet.  Hopefully it’s becoming clear, however, that this bit of support should open up a lot of doors for richer documents and smarter cross-app workflows.

Posted by John Nack at 11:35 PM on October 22, 2008
Copyright © 2014 Adobe Systems Incorporated. All rights reserved.
Terms of Use | Privacy Policy and Cookies (Updated)