Skip to content

Batch Processing

Any graph you build for one image can process a whole folder. Swap its first node for Image Folder and its export for Export Batch, and every image in the folder goes through the same steps. Here is the graph from Your First Graph, set up that way:

Image Folder 1 photos/ batch (x47) 47 files Resize 1 image (x47)size ref image Levels 1 image (x47)mask image Export Batch 1 batch (x47)
A batch of 47 photos flows along the same wires a single photo would. The (x47) on each input says how many frames arrive.

Every node works on batches as it is. When a batch reaches a node that takes one image, the node runs once per frame and the results are bundled back into a batch, so Levels treats 47 photos exactly as it treats one. A setting you change applies to every frame.

A folder on disk. Image Folder reads every matching file in a folder, in the order you choose:

Image Folder 1
Folder
D:/Photos/beach
File Pattern
*.jpg;*.png
Include Subfolders
Off
Sort By
Natural Name
Limit
5

Natural Name sorts shot_2 before shot_10, the way people count. Limit reads only the first few files: set it to 5 while you build the graph, then back to 0 (no limit) to run the whole folder. You can also drop a folder straight onto the canvas.

Images you pick by hand. Collect bundles any images from around the graph into one batch, one input per frame. Drag its rows to reorder the frames, and name and color-code them.

Image In 1 logo.png image Image In 2 icon.png image Collect 1 image 1image 2 batch 2 frames

Variants of one image. Palette Remap makes one recolored frame per palette slot; see Palette Variants.

Pieces of one image. Separate cuts a sprite sheet or a scan into one frame per object it finds, or per grid cell.

Palette Remap and Separate also accept a batch. Each incoming frame is paired with every palette slot, or every piece, so three characters and a four-color palette give twelve frames on one wire:

Image Folder 1 characters/ batch (x3) knight, mage, rogue Palette 1 palette 4 team colors Palette Remap 1 image (x3)palettemask batch (x12) Export Batch 1 batch (x12)
Export Batch 1
File Name
{name}
Writes
knight_red.png
knight_blue.png
knight_green.png
knight_gold.png
mage_red.png
... 12 files

Each frame’s name joins the character’s name and the slot’s, so {name} alone gives every pair its own file. A fan-out can grow fast, so Max Fan-Out Output Frames in Settings > Performance caps it: a run that would go past the cap stops with a message instead of filling your memory.

Split breaks a batch apart again. In Filter mode it sorts frames by name. Here the hero portraits in a folder of game art get a larger size than everything else:

Image Folder 1 portraits/ batch (x30) 30 files Split 1 batch (x30) match (x6)reject (x24) Filter: hero_* Resize 1 image (x6)size ref image 512 px Resize 2 image (x24)size ref image 256 px Export Batch 1 batch (x6) Export Batch 2 batch (x24)

With the Pattern hero_*, the six files whose names start with hero_ leave on Match and the other 24 on Reject. Split’s other modes cut a batch differently:

  • Individual: one output per frame, to wire each into its own place.
  • Chunks: a number of equal parts.
  • Slice: a run of frames from a start position.

To bring branches back together, wire them into a Collect.

Export Batch writes one file per frame, named by its File Name. For the photo graph at the top of this page:

Export Batch 1
Output Directory
export/web
File Name
{name}_web
Format
JPEG
Writes
export/web/beach_01_web.jpg
export/web/beach_02_web.jpg
... 47 files

The Format adds the extension, so the template has none. Naming with Tokens shows how to build names from the frame, its source file, or its number. Turn on Generate Sprite Sheet to pack every frame into one sheet with a JSON file instead. To also write a CSV or JSON list of the frames, add Export Data.

The Preview showing a batch of nine recolored potions on its All view, one tab per frame in the strip above it, with the All button highlighted

Select any node carrying a batch and the Preview shows its frames: All lays them out in a grid, and each frame has a tab of its own. For an animation, such as a walk cycle cut from a sheet by Separate, turn on the Playback Bar and play the frames in order, at 1 to 120 frames per second. See Batches and Variants.

A Tag node renames frames and attaches your own labels to them, which the Preview, Export Batch, and Text all read.

  • Test small first. Set Image Folder’s Limit to a handful of files until the graph is right.
  • Watch it run. Every node in the chain shows a progress bar while a batch runs.
  • Tune the machine. Settings > Performance has Batch Concurrency Cap (how many frames run at once) and Batch Memory Ceiling (how much memory frames in progress may use before they go to disk). Both start at an automatic value sized to your computer.

A batch whose frames are whole texture sets is a library, and it flows through the same way; see Texture Sets.