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

Comments

  • Trevor Morris — 4:48 AM on October 23, 2008

    Very cool stuff, John. Thanks for the interesting and “nerd-tastic” post. ;)

  • imajez — 5:58 AM on October 23, 2008

    Going on from this, how about being able to store different guidelines for each layer as guidelines can be very useful and sometimes you have documents that would be far less cluttered if you could enable just the relevant guidelines for the layer as sometimes they are not relevant to rest of document.

  • jimhere — 6:17 AM on October 23, 2008

    As a meta-tagging freak, I’m happy to hear about this. Like Configurator, it must be implemented in all Adobe apps (their dev teams must hate you).
    [Not hate, just try to ignore. :-) –J.]
    Pixar is, of course, a big-time example of a huge team that could use this. I wonder if smaller teams would use it. Even a fair-sized creative team at an ad agency would just have someone walk over to the other’s desk to talk the file/element details through.
    But from a science-fiction perspective (and my own meta/iptc/exif/xmp/geo freak point of view) this is great for the future.
    [It could certainly enable PS to do some richer things automatically (e.g. retaining some of the metadata of pasted data). We’d then just need systems like Spotlight to grow smarter about indexing *all* the metadata in files. –J.]

  • Christian — 7:25 AM on October 23, 2008

    Sounds interesting. Another nice addition would be the implementation of a notes object to write/read notes. This is not possible at the moment and would be a real nice feature.

  • Trevor Morris — 8:24 AM on October 23, 2008

    Regarding imajez’s post (second from the top):
    Great idea, and a good example of something that could be done by creating a custom panel, one that allowed you to enter layer-based guides positions (stored in layer metadata), along with a few buttons like Create Guides (from metadata), Clear Guides, etc.

  • Nikolai Sklobovsky — 9:26 AM on October 23, 2008

    Very cool stuff, John!

  • Freddywang — 8:03 PM on October 23, 2008

    Wow, I might not notice if you don’t tell us. It’s really cool to have metadata embedded inside every layer.
    @Imajes that is really good idea. Furthermore, we can have tagged slices boundary information, so it can change dynamically. You know it is really irritating when you change your layout dimension, you have to readjust all slices marking — I am talking about the slice tool for web export, I know most people use Fireworks for this task.
    Basically just add listener script attached to the startup event, doing one time scan traversing all layers and updating slices marking.
    By the way, I don’t really understand how features are smuggled into Photoshop :p Are they per request basis? As John noted, layers are now taggable with metadata. But why don’t they make Layer Folder/Group (check LayerSet Object) taggable as well. I might just want to tag collection of my similar layers at their grouping level.
    This discussion is really helpful. Hope it will lead to better future Collaborative Work with Photoshop. Thanks John for bringing up this rather nerd-tastic topic (Hope it won’t hurt your readers).

  • David — 8:05 PM on October 23, 2008

    I would like a non-modal file info panel. Has anyone made one yet? I heard about the CS4 file info panel using Flash/Flex and assumed it was non-modal.
    [File Info is modal, but you could knock together a panel that reads and writes metadata values. As noted in a previous entry, XMPScript (new to PSCS4) should make it much easier to manipulate metadata via scripting. You could start with the source code for the per-layer tagging script & create a File Info alternative. –J.]

  • Simon — 10:00 AM on October 24, 2008

    One can get/set arbitrary XMP metadata per layer through the scripting API, not just the the simple name/value descriptor pairs. One of the ways PS CS4 takes advantage of the per-layer XMP metadata is that when you load images through one of those “Load Images into Stack” or “Photomerge” automation scripts, the camera metadata from the original images are preserved as per-layer XMP metadata. As John has indicated, one can manipulate it via the XMPScript supported by PS CS4.
    [Thanks for the details, Simon. (Simon and Pete Falco were the rock stars who teamed up to implement this support. –J.]

  • Ted Dillard — 4:29 PM on November 01, 2008

    John, one more for today and I promise I’ll stop spamming your comments…
    A question about this, and I have to preface by saying I know little or nothing about the actual structure or process of metadata. Just a simple photographer. But I noticed that CS3 had uuid lines that, in CS4 seem to be replaced by iid and did lines.
    Are those changes related to this change of architecture?
    [I’m afraid I don’t know the details, but CS4 added new support for GUIDs. I suspect that what you’re seeing is related. –J.]

  • Jim — 5:27 PM on November 12, 2008

    Hi John,
    We are developing an application using flex where we overlay images on top of one another. Pretty simple process, however we would like to save the image back to the camera so people can view the edited picture on the camera viewfinder. Would this method you mention allow this to happen? Thanks.
    Jim
    [Hmm–I don’t see how this feature would facilitate your project, but feel free to drop me a line directly so that we can talk more. –J.]

  • Todd Storbeck — 1:54 PM on April 09, 2009

    John, How do you r/w xmp document info in Photoshop flex panel? You wrote, “XMPScript (new to PSCS4) should make it much easier to manipulate metadata via scripting.” — but It looks like xmpscript is very limited – and the per layer example does not address r/w document xmp – which would be required to do a non-modal fileinfo in a flex panel. thanks for your help!

  • Olumide — 5:11 AM on September 09, 2009

    Cool! … This feature has been on my wishlist for several years now.
    See: http://thread.gmane.org/gmane.comp.video.tiff/3317

  • Dolemite — 9:20 PM on December 29, 2010

    Hey, found your website searching for layer metadata. I tried adding your plugin to Photoshop CS5 and while it runs and you can enter data, it doesn’t appear to stick to the level. Data entered stays the same, regardless of level selection, until you shut Photoshop down.

    Any idea? Thanks.

  • Mike BW — 2:29 PM on December 12, 2011

    As Dolemite said, this no longer works in CS5 (or CS5.1). I tried it in CS4 though and it does seem to work still. Would really like to see this updated though.

    What I am trying to do with this is tag several images all to be used in an InDesign document, and have ID automatically pull the contents of the Description field and use that on export to a tagged / accessible PDF. My alternative right now is to save out each layer and tag that in Bridge, which works, but tagging each layer in Photoshop would be faster since so many these images are the same dimensions, I can just format everything in one app.

  • Mike BW — 9:13 AM on December 14, 2011

    Thanks John.

    Update- there does indeed appear to be a version for CS5 in the Photoshop CS5 SDK available here- http://www.adobe.com/devnet/photoshop/sdk.html

    Just download and unzip that, and then you will find the same “PerLayerMetadata” .jsx and .swf files in the flashpanels>samples>per layer metadata>bin-debug folder, which you then copy to your Adobe Photoship CS5 Plug-ins>Panels folder.

    What I need to figure out now is if and how you can get InDesign to see that metadata from the Photoshop file. Placing a PSD file into an InDesign document is easy, and support for choosing what layers you want is also there, but so far I can’t seem to access the individual Description metadata that I have assigned to each layer in Photoshop.

Copyright © 2014 Adobe Systems Incorporated. All rights reserved.
Terms of Use | Privacy Policy and Cookies (Updated)