Photoshop Blog

May 29, 2014 /Photoshop /

Custom workflows with Adobe Generator in Photoshop CC

Adobe Generator, part of Photoshop CC, is a platform for accessing Photoshop in powerful new ways. Generator allows plug-ins to access rich information about open documents in real-time. Most people know that you can export web assets through Generator, but it can be used for so much more. Check out the custom Generator plug-in that Adobe employee CJ Gammon built to help automate the creation of an online comic strip for PBS:

In some companies, developers and designers attempt to automate workflows as much as possible, sometimes creating custom tools to streamline the process. But what if developers could tap into the tools their designers are already using? This is where Adobe Generator for Photoshop CC comes in. Generator allows you to access and automate commands and respond to changes in Photoshop.

Word Girl from PBS - Generator in Photoshop CC

We recently tried out Generator in an experiment with PBS Kids to bring one of their children’s comics to the web. They provided us with Word Girl, a comic that follows a child with super powers and a super vocabulary. Our job was to convert it into a web experience incorporating animation.

Because we were given flat artwork, we knew that we would have to break up the frames into separate layers in order to add animation, likely more than one layer for each cell. Ultimately there were over 200 individual images.

Wordgirl for PBS frames - Using Generator in Photoshop CC

As you can imagine, this would be a pretty labor-intensive task with a number of challenges. We knew one challenge would be saving out all of these layers as optimized files with a consistent naming convention. We also knew it would be important to know the position and structure of each layer so that we could lay out the images correctly without manually positioning them. Because we wanted to animate the content within their cell frame, we would also need to mask layers so they would get clipped if they moved outside of the frame. Pulling this data from Photoshop and using it directly in our site would save us the trouble of creating these masks by hand.

The pain points we encountered can be categorized into two basic categories: asset generation and document structure.

  • Asset generation is the ability to turn each layer into an optimized image with naming conventions to fit our needs.
  • Document structure is obtaining key data like position and masks out of the document to use in building the animation.

Using Generator in Photoshop CC

Asset Generation

For asset generation, a lot of the work was done for us already. Photoshop CC ships with the ‘Image Assets’ Generator plug-in which allows you to use your layer name to automate the process of saving out all your layers as optimized web images. This plug-in is published on Github for anyone to tweak or improve.

Using Generator in Photoshop CC

Document Structure

To collect the document structure, we decided to create our own Generator plug-in using the ‘Image Assets’ plug-in as a starting point. Fortunately collecting the document structure is relatively easy. Since Generator runs on node.js, all the code is written in JavaScript and the Generator API provides access to the core PSD structure in JSON.

We were then able to create a method within our plug-in that saves this out to a .json file to be loaded into our website. This file contained not only the layer structure and names, allowing us to easily iterate through them and load the necessary images, but also the position of the layer’s bounds. This gave us the exact position our images needed to be placed at to reflect their position in the PSD.

Using Generator in Photoshop CC

The next step was to collect the clip path, so that images moving outside of their frame would be clipped appropriately. To do this we set up our Photoshop document with all the layers of each cell in groups. Then we created a vector mask on that group to be used as the clip path for the images. The vertices of a vector mask are not available in the document info JSON, but a recently added method in Generator allowed us to query the vector mask of a given layer. We used this to collect the vector mask data and include it with the document info.

Using Generator in Photoshop CC

Simply by running this script we automatically produced the images and a JSON file with the information we needed to reassemble the PSD in HTML. We were then able to go into the website and animate the layers manually (Yes, there are some things we still need to do manually, but maybe one day this will be solved too).

Building this custom solution likely saved weeks of time and frustration. This project is just one small example of how designers and developers can build custom workflows to speed up and simplify the tedious aspects of their job using Adobe Generator in Photoshop CC.

Generator in Photoshop CC




Join the discussion

  • By Terry Toepfer - 11:01 AM on May 29, 2014  

    This is a great insight on what it takes to customize Photoshop’s generator. I had no idea it was possible. Thank-you!

  • By Bill Brown - 7:58 AM on May 30, 2014  

    I suppose you could mess around with a bunch of custom scripts trying to force Photoshop, HTML, CSS, and Javascript into some sort of Frankenstein designer/animator/developer workflow.
    Or you could just use Flash and let the artist create and animate the assets in a single efficient workflow.
    If you have time and budget to burn, then option 1 will get you street cred with the open source fanatics.

    • By tony - 5:49 PM on May 30, 2014  

      @Bill Brown

      Umm because flash doesn’t work on a majority of tablets and smartphones. derp.

      • By Jonsi - 2:53 PM on May 31, 2014  

        True – but Flash Pro can export to HTML5 which works pretty well on mobiles and tablets.

  • By Sesli chat - 12:55 PM on June 2, 2014  

    Umm flaş tablet ve akıllı bir çoğunluğu çalışmıyor çünkü.

  • By Tim Foley - 3:41 AM on June 16, 2014  

    Oh wow. I really like this feature in the photoshop cc. It sorts a lot of work for me easily.

  • By trung tam bao hanh - 8:59 AM on August 5, 2014  

    Oh wow. I really like this.

  • By Mehmet - 7:00 AM on August 8, 2014  

    Its really good information that make us have knowledge about it. Thanks a lot

  • By Gruff - 12:03 AM on August 19, 2014  

    Where can we get the information to allow generator to output the position data in a .json format? Thanks

  • By Jack - 8:10 AM on January 4, 2015  

    Wow. That’s a good one in many Photoshop CC’s features. The code looks like CSS.

  • By ve may bay gia re - 11:48 PM on February 8, 2015  

    Oh wow. I really like this.

  • By chu ky so fpt - 12:15 AM on March 4, 2015  

    Oh. Thank you very much

  • By thiet ke nha pho dep - 3:18 AM on November 2, 2015  

    Thank for this content

  • By trungtambaohanhelectrolux - 12:14 AM on December 16, 2015  

    The content is very useful , thank you

  • By thiết kế nhà đẹp - 6:16 AM on March 4, 2016  


  • By David King - 7:28 AM on May 13, 2016  

    Thanks you so much for sharing this and i’m also glad to see this .

  • By Jennifer R. Evans - 8:23 AM on May 14, 2016  

    It’s looks awesome . Everyone’ll impress to see this post .

  • By Song Đấu - 10:22 AM on June 2, 2016  

    Song Đấu Tập 14 cùng những màn so tài đầy kịch tính đến nghẹt thở và những màn biểu diễn về khả phi thường của các thí sinh.