PHOTOSHOP.COM BLOG

See what's possible.

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

 

 

TAGGED AS: , , ,

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

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.

    @Bill Brown

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

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

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

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

Oh wow. I really like this.

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

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

COMMENTS

(required)

(required)


6 + = thirteen