RSS< Twitter< etc

Draft Scripting Cookbook

We have compiled a series of commonly used code recipes in Draft into this cookbook. First off, if you aren't familiar, a code recipe is a snippet of code that captures a common case. The goal is so that you don't have to remember exactly how to do something, like how to setup a certain type of video encoder, and instead have a place to quickly refer to when you need to cook something up!

You can use this cookbook both as way to learn new techniques and functions in Draft, as well as a handy reference whenever you need it. While reading it from start to finish would be helpful, the intention is that you use it by jumping around the table of contents based on what you are interested in.

We will be adding new recipes in the future and if you would like to suggest new additions. please post on our forums.

These recipies make the assumption that you are familiar with the Python programming language, so we won't be taking too many pains to explain the syntatic details of the recipes. The discussions will focus primarily on what Draft is doing and what other options might be available to you.

Conventions Used

Here are the conventions we use throughout this cookbook. 

Each recipe is in response to a given Problem. This can be something fairly simple like Create an Image to something much more complex like Compositing images using Anchors.

The Solution is the code snippet that solves the stated problem. The recipe will be formatted with Python highlights to make it easier to look at. Copy the recipe code into your own scripts to use it.

Finally, each recipe is accompanied by a Discussion of the solution. The discussion is not required reading, but often includes further details and offers helpful hints when needing to solve more complex problems. Where appropriate, sometimes a See Also section is included to link to other relevant recipes or documentation.

When we refer to code objects within the discussion text, the object names are bolded to help make them stand out. When we include code lines, they will appear on their own line and be in a different font.

For example, the Draft library is imported into a Python script in the standard manner:

import Draft

The module Draft contains several important objects such as Draft.Image   

Contents

The cookbook has the following sections:

Basic Operations

The basic operations cover the basics of Draft and what you will see in most Draft scripts. Things like creating an image and doing some simple text annotations are covered here, as well as how to setup a video encoder to create a video file. 

Intermediate Operations

These operations are more involved but are typical things done with Draft such as working with Stereo footage and recipes for working with image sequences. 

Deadline Integration

The Deadline section focusses specifically on how to connect your Draft scripts to Deadline and how to take advantage of things like custom parameters and Deadline Job meta-data. 

Advanced Operations

Coming soon!

Color Operations

This section focuses on color management within Draft and how to manipulate color spaces.