apply_operations
Run an ordered batch of sprite edits in one atomic call: if any operation fails, the whole batch rolls back. Validate the plan first with dry_run.
Instructions
Apply a list of edit operations to a sprite in one atomic, single-process batch.
Each operation is {"op": "<name>", "args": {...}}. Ops run in order against the
same open sprite, so later ops see earlier ones (e.g. add a layer then draw on it).
Arguments not listed for an op are rejected rather than ignored.
Atomic: if any op fails the whole batch is rolled back and nothing is saved; the
error names the failing op index. dry_run=True validates the op list and returns
the plan without launching Aseprite (shape checks only; runtime issues like a
missing layer surface on a real run).
Frames are 1-based, and an arg=frame argument must name a frame that already
exists: an out-of-range frame is rejected with the sprite's valid range rather than
clamped, so a per-op summary always describes the frames actually touched.
Returns a workflow_manifest.v1 (kind "batch") with a per-op operations list, and,
when the ops touched pixels, the same pixels_written / pixels_outside_selection /
selection_applied fields every other tool reports: a batch run under an active
selection is clipped to it, and these say how much the mask refused.
Operations and their arguments ('?' marks an optional argument): add_frame(duration_ms=int?, copy_from=frame?) add_layer(name=str, group=str?, opacity=int?, blend_mode=str?, visible=bool?) add_slice(name=str, x=int, y=int, width=int, height=int, color=color?) add_tag(name=str, from=frame, to=frame, direction=str?, color=color?) [also accepts from_frame for from, to_frame for to] clear_layer(layer=str?, frame=frame?) copy_cel(layer=str, from=frame, to=frame, to_layer=str?) [also accepts from_frame for from, to_frame for to] delete_cel(layer=str, frame=frame) draw_ellipse(layer=str?, frame=frame?, cx=int, cy=int, rx=int, ry=int, color=color) draw_line(layer=str?, frame=frame?, x1=int, y1=int, x2=int, y2=int, color=color) draw_pixels(layer=str?, frame=frame?, pixels=list, color=color?) draw_rectangle(layer=str?, frame=frame?, x=int, y=int, width=int, height=int, color=color) duplicate_frame(frame=frame) fill_ellipse(layer=str?, frame=frame?, cx=int, cy=int, rx=int, ry=int, color=color) fill_layer(layer=str?, frame=frame?, color=color) fill_rectangle(layer=str?, frame=frame?, x=int, y=int, width=int, height=int, color=color) remove_frame(frame=frame) remove_layer(layer=str) remove_slice(name=str) remove_tag(name=str) rename_layer(layer=str, new_name=str) replace_color(layer=str?, frame=frame?, from=color, to=color, tolerance=int?) [also accepts from_color for from, to_color for to] set_all_frame_durations(duration_ms=int) set_cel_opacity(layer=str, frame=frame, opacity=int) set_cel_position(layer=str, frame=frame, x=int, y=int) set_frame_duration(frame=frame, duration_ms=int) set_layer_opacity(layer=str, opacity=int) set_layer_visible(layer=str, visible=bool) set_pixel(layer=str?, frame=frame?, x=int, y=int, color=color)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | Default: false. | |
| filename | Yes | ||
| operations | Yes |