Easing the gif creation process part 2: ExtendScript

Written on 15 October 2013, 10:10pm under Techniques

Tagged with: ,

In this second article about easing the gif creation process we’ll see how we can automate the process of firing up the render and sending the video file to Photoshop with some ExtendScript.

First, what is ExtendScript?

ExtendScript is an extended form of JavaScript used by several Adobe applications such as Photoshop, Illustrator, and InDesign. ExtendScript is a good and efficient way to achieve almost anything in After Effects.

We will not go over the basics of ExtendScript in this article since they’ve been explained here and there already. Here is some resources to help you get started with ExtendScript:

  1. David Torno’s extensive After Effects ExtendScript Training
  2. After Effects CS6 Scripting Guide
  3. Adobe Javascript Tools Guide

Get the script

Just save Render and Send to Photoshop.jsx in your After Effects scripts folder.

  • Windows: Program Files\Adobe\Adobe After Effects \Support Files\Scripts
  • OS X: /Applications/Adobe After Effects /Scripts

Here’s what the script will do:

  1. Send your current composition to the render queue
  2. Start the render queue
  3. Open and focus Photoshop
  4. Open the previously rendered file

Understanding the code

Render and Send to Photoshop repository is hosted on Github so you can see the code behind it. It is written in CoffeeScript which helps keeping code clean and light. We’ll cover integrating CoffeeScript with ExtendScript in an upcoming article.

Although the script contains some boilerplate code to keep the function scope clean, it could be resumed to three lines.

Adding the activeItem (this is our currently opened composition) to the render queue and saving the renderQueue item to a variable.

outputFile = app.project.renderQueue.items.add(app.project.activeItem);

Starting the render queue

app.project.renderQueue.render();

Sending our previously saved variable outputFile‘s file path property to Photoshop.

photoshop.open(new File(outputFile.outputModule(1).file));

Although the script is very simple, it will make exporting a gif from After Effects take two operations instead of five. This can make a pretty big difference at the end of the day.

The script being on Github also allows anybody to contribute, if you feel that you can improve it go ahead and submit a pull request!

Other popular articles