aseprite-mcp
v0.1.1MCP server for Aseprite: 73 tools that drive the pixel art editor through its Lua API, headless or live in the open window.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
status
Shows the Aseprite executable in use, its version, and whether a live Aseprite is connected to the bridge.
install_extension
Copies the bridge extension into Aseprite's user extensions folder. A running Aseprite must be restarted to load it.
launch_aseprite
Starts the Aseprite GUI with the bridge extension and waits for it to connect, enabling live mode. The first time, Aseprite asks to allow the script's network and file access; tick 'Give full trust' / 'Don't show again' in that dialog.
| Parameter | Type | Description |
|---|---|---|
file | string | Optional sprite file to open |
waitSeconds | number | How long to wait for the bridge (default 30) |
run_lua
Runs Lua code inside Aseprite with the full scripting API (app, Sprite, Image, Layer, Color, ...). Globals: `args` (your args object), `sprite` (resolved sprite or app.sprite), `MCP` (helper runtime: MCP.color(), MCP.layer(spr, ref), MCP.sprite_info(spr) ...). `print` output is captured. The `return` value is sent back as JSON. Use api_docs for the API reference.
| Parameter | Type | Description |
|---|---|---|
code * | string | Lua source. Use `return` to send a value back. |
args | object | Values available to the code as `args` |
backend | string | auto (default): live Aseprite if connected, else headless batch |
mutates | boolean | Batch mode: false skips saving the sprite afterwards (default true) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
run_command
Executes any Aseprite menu command (app.command.<name>) with parameters, e.g. Flip, Rotate, Outline, BrightnessContrast, ColorQuantization, LinkCels, ReverseFrames, AutocropSprite. See list_commands for names and parameters. Strings like '#ff0000' become Colors; {x,y,width,height} becomes a Rectangle. ui=false is added unless allowUi is true.
| Parameter | Type | Description |
|---|---|---|
name * | string | Command name, e.g. 'Outline' |
allowUi | boolean | Let the command open its dialog (live mode only) |
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | Frame to make active before running |
layer | Layer to make active before running | |
mutates | boolean | Batch mode: false skips saving (default true) |
params | object | Command parameters |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
list_commands
Lists Aseprite commands usable with run_command, with their parameters (extracted from the Aseprite source).
| Parameter | Type | Description |
|---|---|---|
query | string | Case-insensitive filter on name/description |
api_docs
Reads the Aseprite Lua API reference (bundled from github.com/aseprite/api). Without a topic, lists topics. Topics include app, sprite, layer, cel, image, color, palette, tag, slice, tileset, selection, dialog, websocket, and command/<CommandName>.
| Parameter | Type | Description |
|---|---|---|
topic | string | e.g. 'image', 'app', 'command/ExportSpriteSheet' |
cli
Runs the Aseprite command line in batch mode (aseprite -b <args>) and returns its output. Useful for --sheet/--data exports, --split-layers, --list-tags, --save-as with {layer}/{frame} templates, --scale, --color-mode, etc. See https://www.aseprite.org/docs/cli/.
| Parameter | Type | Description |
|---|---|---|
args * | array | Arguments after -b, e.g. ['in.aseprite', '--scale', '4', '--save-as', 'out.png'] |
timeoutSeconds | number |
app_state
Returns Aseprite's current state: open sprites, active sprite/layer/frame, foreground/background colors, tool, brush, timeline range and editor zoom (live).
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
set_active
Changes what is active in the UI: sprite/layer/frame, foreground/background color, tool, brush, editor zoom, and the timeline range (selected frames/layers/colors). Mostly useful in live mode.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
bgColor | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
brush | object | Brush: built-in shape and size, or a custom image brush |
fgColor | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
range | object | Timeline/palette selection (live only) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tool | string | Tool id, e.g. pencil, eraser, paint_bucket, rectangular_marquee |
zoom | number | Editor zoom factor (1 = 100%) |
undo_redo
Undoes or redoes steps on a sprite (live mode; batch processes have no history between calls).
| Parameter | Type | Description |
|---|---|---|
action * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
steps | integer |
list_preferences
Lists Aseprite preference sections and options (from pref.xml) for use with the preferences tool.
| Parameter | Type | Description |
|---|---|---|
section | string | Only this section, e.g. 'grid' or 'tool_box' |
preferences
Gets or sets an Aseprite preference (app.preferences.<section>.<option>), a tool preference (tool=<id>) or a per-sprite document preference (document=true). Use list_preferences to discover names.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
option * | string | Option name; nested options use dots, e.g. 'brush.size' with section from the tool prefs |
section * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
document | boolean | Read the sprite's document preferences |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tool | string | Read tool preferences for this tool id |
value |
list_sprites
Lists sprites open in Aseprite.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
new_sprite
Creates a new sprite. In batch mode 'file' is required (the sprite is saved there).
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
width * | integer | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
background | Fill the first layer with this color | |
backgroundLayer | boolean | Turn the first layer into a Background layer |
colorMode | string | |
file | string | Save to this path (.aseprite keeps layers/frames) |
frameDurationMs | integer | |
frames | integer | |
layerName | string | |
palette | Colors, or {preset:'DB32'} / {file:'pal.gpl'} |
open_sprite
Opens a sprite file (any format Aseprite reads: .aseprite, .png, .gif, .jpg, .webp, .bmp, .tga, .pcx, .ico, .flc, .qoi, .psd...) and returns its structure. In live mode it opens a tab.
| Parameter | Type | Description |
|---|---|---|
file * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
oneFrame | boolean | Load only the first frame |
get_sprite_info
Returns a sprite's full structure: size, color mode, frames and durations, layer tree (with opacity, blend mode, visibility...), tags, slices, tilesets, palette size, grid, selection and active layer/frame.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
includeCels | boolean | Also list every cel |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
save_sprite
Saves a sprite (Save / Save As), or with copy=true saves a copy without changing the sprite's file name. The extension picks the format. Single-image formats get one file per frame (name1.png, name2.png...); the result lists the files written.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
copy | boolean | |
file | string | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
close_sprite
Closes an open sprite (live mode).
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
discardChanges | boolean | |
save | boolean | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
set_sprite_properties
Changes sprite metadata: filename, user data, tab color, transparent color index, pixel ratio, grid bounds, user properties, color space.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
colorSpace | string | |
convertColorSpace | boolean | Convert pixels instead of only assigning the color space |
data | string | |
filename | string | |
gridBounds | object | |
pixelRatio | object | |
properties | object | User-defined properties to set (object.properties) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
transparentColor | integer | |
useLayerUuids | boolean |
resize_sprite
Scales the whole sprite (all layers and frames). Give width and/or height, or scale.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
height | integer | |
method | string | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
scale | number | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
width | integer |
canvas_size
Grows or shrinks the canvas without scaling pixels: either margins (left/top/right/bottom, negative values cut) or a new width/height with an anchor.
| Parameter | Type | Description |
|---|---|---|
anchor | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
bottom | integer | |
height | integer | |
left | integer | |
right | integer | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
top | integer | |
trimOutside | boolean | |
width | integer |
crop_sprite
Crops the sprite to a rectangle, to the selection (mode='selection'), or trims empty borders (mode='auto').
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
byGrid | boolean | |
mode | string | |
rect | object | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
change_color_mode
Converts the sprite to RGB, grayscale or indexed, with optional dithering.
| Parameter | Type | Description |
|---|---|---|
mode * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
dithering | string | |
ditheringFactor | number | |
ditheringMatrix | string | e.g. 'bayer2x2', 'bayer4x4', 'bayer8x8' |
fitCriteria | string | |
rgbmap | string | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
toGray | string |
flip_rotate
Flips and/or rotates the whole sprite, the active cel(s) of a layer/frame, or the selection.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
flip | string | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
rotate | number | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
target | string |
add_layer
Adds an image, group or tilemap layer, optionally inside a group or above/below another layer, with its properties set.
| Parameter | Type | Description |
|---|---|---|
above | string | Place directly above this layer |
backend | string | auto (default): live Aseprite if connected, else headless batch |
below | string | Place directly below this layer |
blendMode | string | normal, multiply, screen, overlay, darken, lighten, color_dodge, color_burn, hard_light, soft_light, difference, exclusion, hue, saturation, color, luminosity, addition, subtract, divide |
collapsed | boolean | Group layers only |
color | Timeline color | |
continuous | boolean | |
data | string | User data text |
editable | boolean | false locks the layer |
frame | integer | Frame for 'image' (default 1) |
image | Fill the new layer (image or reference) with this image | |
name | string | |
opacity | integer | |
parent | string | Group layer to move into; '' moves to the top level |
properties | object | User-defined properties to set (object.properties) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
stackIndex | integer | Position among siblings (1 = bottom) |
tileSize | object | Tilemap layers: tile size |
type | string | |
visible | boolean | |
x | integer | Position of 'image' |
y | integer |
update_layer
Changes layer properties: name, visibility, lock, opacity, blend mode, color, data, parent group, stack position.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
blendMode | string | normal, multiply, screen, overlay, darken, lighten, color_dodge, color_burn, hard_light, soft_light, difference, exclusion, hue, saturation, color, luminosity, addition, subtract, divide |
collapsed | boolean | Group layers only |
color | Timeline color | |
continuous | boolean | |
data | string | User data text |
editable | boolean | false locks the layer |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
name | string | |
opacity | integer | |
parent | string | Group layer to move into; '' moves to the top level |
properties | object | User-defined properties to set (object.properties) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
stackIndex | integer | Position among siblings (1 = bottom) |
tileset | Tilemap layers: tileset to use | |
visible | boolean |
delete_layer
Deletes a layer (and its children if it is a group).
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
duplicate_layer
Duplicates a layer with all its cels.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
name | string | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
merge_layers
Merges a layer into the one below (mode='down'), flattens all layers ('flatten'), or flattens only visible layers ('visible').
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
mode | string | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
convert_layer
Converts a layer: to a Background layer, from Background to a normal layer, or between image and tilemap layers.
| Parameter | Type | Description |
|---|---|---|
to * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
add_frames
Adds frames. By default copies the previous frame's cels; empty=true adds blank frames.
| Parameter | Type | Description |
|---|---|---|
at | integer | Frame number for the first new frame (default: end) |
backend | string | auto (default): live Aseprite if connected, else headless batch |
copyFrom | integer | Frame to copy (default: the frame before 'at') |
count | integer | |
durationMs | integer | |
empty | boolean | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
delete_frames
Deletes one frame, a range, a list, or a tag's frames.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
set_frame_duration
Sets frame durations in milliseconds for one frame, a range, a list, a tag, or 'all'.
| Parameter | Type | Description |
|---|---|---|
durationMs * | integer | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
move_frame
Moves a frame (with its cels) to another position.
| Parameter | Type | Description |
|---|---|---|
from * | integer | |
to * | integer | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
get_cels
Lists cels (layer/frame pairs with images) with bounds, opacity, z-index and data, filtered by layer and frames.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
update_cel
Changes a cel: position (absolute x/y or relative dx/dy), opacity, z-index, color, data, properties, or moves it to another frame.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
data | string | |
dx | integer | |
dy | integer | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
opacity | integer | |
properties | object | User-defined properties to set (object.properties) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
toFrame | integer | |
x | integer | |
y | integer | |
zIndex | integer |
delete_cel
Deletes the cel(s) of a layer in the given frames.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
copy_cel
Copies a cel's image to another layer/frame (and optionally another open sprite).
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
fromFrame | integer | 1-based frame number. Defaults to the active frame (or 1). |
fromLayer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
fromSprite | Source sprite (default: same) | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | Destination sprite | |
toFrame | ||
toLayer | ||
x | integer | |
y | integer |
draw_pixels
Sets individual pixels on a layer/frame (one undo step). Either 'pixels' as [[x,y,color],...] / [{x,y,color}], or pixel art as 'rows' of characters with a 'legend' mapping each character to a color; rows start at (x,y). Unmapped ' ' and '.' are skipped; map '.' to 'transparent' to erase. The cel grows as needed; pixels outside the canvas are dropped.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
blend | boolean | Alpha-blend over existing pixels instead of replacing |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
legend | object | |
pixels | array | |
rows | array | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
x | integer | Left of the rows grid (default 0) |
y | integer | Top of the rows grid (default 0) |
get_pixels
Reads pixels of the rendered frame (all visible layers) or of one layer. Default format 'legend' returns rows of characters plus a legend of colors ('.' = transparent); 'hex' returns a grid of '#rrggbbaa' (null = transparent). Indexed sprites return palette indices.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
format | string | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Read only this layer (default: the composited frame) | |
maxPixels | integer | Safety limit on area (default 16384) |
rect | object | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
use_tool
Draws with an Aseprite tool as if the user dragged through 'points' (app.useTool). Tools: pencil, brush-like strokes with eraser/spray/blur/jumble, line, curve (4 points), rectangle, filled_rectangle, ellipse, filled_ellipse, paint_bucket (1 point), gradient, contour, polygon, and selection tools (rectangular_marquee, elliptical_marquee, lasso, polygonal_lasso, magic_wand).
| Parameter | Type | Description |
|---|---|---|
points * | array | |
tool * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
bgColor | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
brush | object | Brush: built-in shape and size, or a custom image brush |
brushSize | integer | |
button | string | right uses the background color |
color | Default: foreground color | |
contiguous | boolean | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
ink | string | |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
opacity | integer | |
pixelPerfect | boolean | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
selectionMode | string | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tilemapMode | string | |
tilesetMode | string | |
tolerance | integer |
draw_image
Draws an image file (PNG, etc.) into a layer/frame at (x,y). mode 'blend' composites over existing pixels, 'copy' overwrites the area, 'replace' swaps the whole cel image. Optional source crop, scale or target size.
| Parameter | Type | Description |
|---|---|---|
file * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
blendMode | string | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
height | integer | |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
mode | string | |
opacity | integer | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
scale | number | |
sourceRect | object | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
width | integer | |
x | integer | |
y | integer |
clear
Clears a layer's cel(s) to transparent (or fills with a color): whole cel, a rect, or the selected area.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
rect | object | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
useSelection | boolean |
replace_color
Replaces one color with another on a layer (or all layers) across frames, with optional per-channel tolerance (RGB).
| Parameter | Type | Description |
|---|---|---|
from * | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
to * | ||
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
tolerance | integer |
apply_filter
Applies an image filter command to the active cel(s) or selection: BrightnessContrast, HueSaturation, ColorCurve, ConvolutionMatrix, Despeckle, InvertColor, Outline, ReplaceColor. Params follow list_commands (e.g. Outline {color:'#000000', place:'outside', matrix:'circle'}; HueSaturation {hue, saturation, lightness, alpha}; BrightnessContrast {brightness, contrast}).
| Parameter | Type | Description |
|---|---|---|
filter * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
channels | string | e.g. 'rgba', 'rgb', 'a' |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
params | object | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
select
Creates or changes the selection: rect, ellipse, polygon, magic_wand (point), by_color, all, none, invert, reselect, content (layer pixels), modify (expand/contract/border), move (dx/dy), get, save or load (to/from a .msk or image file). The selection lives only in live mode or inside one run_lua call.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
brush | string | |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
contiguous | boolean | |
dx | integer | |
dy | integer | |
file | string | save/load: .msk (Aseprite selection file) or an image (opaque pixels = selected) |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
mode | string | |
modifier | string | |
point | ||
points | array | |
quantity | integer | |
rect | object | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tolerance | integer |
selection_edit
Acts on the selection: copy, copy_merged, cut, paste (optional x,y), delete, fill, stroke (with color), move_content / move_bounds (dx,dy, wrap), new_sprite, new_layer_via_copy, new_layer_via_cut, crop.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
dx | integer | |
dy | integer | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
wrap | boolean | |
x | integer | |
y | integer |
get_palette
Returns the sprite palette as '#rrggbbaa' colors (index 0 first).
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
index | integer | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
set_palette
Changes the palette: set colors starting at 'start', replace it entirely, resize, load from a file (.gpl, .pal, .act, .ase, .png...) or a built-in preset (e.g. DB16, DB32, PICO-8...), or generate it from the sprite's colors (fromSprite).
| Parameter | Type | Description |
|---|---|---|
algorithm | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
colors | array | |
file | string | |
fromSprite | boolean | Build a palette from the sprite (ColorQuantization) |
maxColors | integer | |
preset | string | |
replace | boolean | Palette becomes exactly 'colors' |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
size | integer | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
start | integer | |
withAlpha | boolean |
save_palette
Saves the sprite palette to a file (.gpl, .pal, .act, .png, .ase, .hex...).
| Parameter | Type | Description |
|---|---|---|
file * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
add_tag
Adds an animation tag over a frame range.
| Parameter | Type | Description |
|---|---|---|
aniDir | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
data | string | |
from | integer | |
name | string | |
properties | object | User-defined properties to set (object.properties) |
repeats | integer | 0 = infinite |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
to | integer |
update_tag
Changes a tag's name, range, direction, repeats, color or data.
| Parameter | Type | Description |
|---|---|---|
tag * | ||
aniDir | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
data | string | |
from | integer | |
name | string | |
properties | object | User-defined properties to set (object.properties) |
repeats | integer | 0 = infinite |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
to | integer |
delete_tag
Deletes a tag (frames are kept).
| Parameter | Type | Description |
|---|---|---|
tag * | ||
backend | string | auto (default): live Aseprite if connected, else headless batch |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
add_slice
Adds a slice (with optional 9-slice center and pivot), or duplicates one with copyFrom.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
bounds | object | |
center | 9-slice center, relative to the slice; false removes it | |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
copyFrom | Slice to duplicate | |
data | string | |
name | string | |
pivot | Pivot relative to the slice; false removes it | |
properties | object | User-defined properties to set (object.properties) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
update_slice
Changes a slice.
| Parameter | Type | Description |
|---|---|---|
slice * | ||
backend | string | auto (default): live Aseprite if connected, else headless batch |
bounds | object | |
center | 9-slice center, relative to the slice; false removes it | |
color | '#rrggbb', '#rrggbbaa', a name, a palette index, or {r,g,b,a} / {h,s,v,a} / {h,s,l,a} / {gray,a} | |
data | string | |
name | string | |
pivot | Pivot relative to the slice; false removes it | |
properties | object | User-defined properties to set (object.properties) |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
delete_slice
Deletes a slice.
| Parameter | Type | Description |
|---|---|---|
slice * | ||
backend | string | auto (default): live Aseprite if connected, else headless batch |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
tileset
Tileset operations: list, add (tileSize, count), update (name, baseIndex, data), delete, add_tile, delete_tile, get_tile (pixels as rows+legend), set_tile (rows+legend or an image file). Tile index 0 is the empty tile.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
baseIndex | integer | |
count | integer | |
data | string | |
file | string | |
index | integer | Tile index |
legend | object | |
name | string | |
properties | object | User-defined properties to set (object.properties) |
rows | array | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tileSize | object | |
tileset | Tileset index (1-based), name, or a tilemap layer |
tilemap
Reads (action 'get') or writes (action 'set') the tile indices of a tilemap layer's cel. Set with 'cells' [{col,row,tile}] or 'rows' (2D array of tile indices, -1/null to skip) starting at col/row.
| Parameter | Type | Description |
|---|---|---|
action | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
cells | array | |
col | integer | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
row | integer | |
rows | array | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
draw_text
Draws text onto a layer. In live mode it uses Aseprite's text renderer with any font Aseprite knows (its built-in 'Aseprite' pixel font, or an installed system font by name such as 'Arial'). In batch mode, or with font='builtin', it uses a built-in 5x7 pixel font that can be scaled by whole numbers. Multi-line text with \n is supported.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
align | string | Horizontal alignment relative to x |
backend | string | auto (default): live Aseprite if connected, else headless batch |
color | Default black | |
font | string | 'builtin', 'Aseprite', or a system font name (live mode) |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
letterSpacing | integer | Builtin font: pixels between letters (default 1) |
lineHeight | integer | Other fonts: pixels from one line to the next |
lineSpacing | integer | Builtin font: pixels between lines (default 1) |
measureOnly | boolean | Only return the text size, draw nothing |
opacity | integer | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
scale | integer | Integer scale for the builtin font |
size | number | Font size for Aseprite/system fonts (default 6) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
x | integer | |
y | integer |
draw_shapes
Draws vector shapes with optional antialiasing: rect, rounded_rect, oval/ellipse, line, polyline, polygon, bezier (cubic, points = start then control1, control2, end per segment), or path (ops: move/line/cubic/close). Each shape is stroked (width) or filled. Antialiasing is off by default to keep hard pixel edges. For pixel-exact aliased shapes use_tool is closer to Aseprite's own tools.
| Parameter | Type | Description |
|---|---|---|
shapes * | array | |
antialias | boolean | Default antialiasing (false) |
backend | string | auto (default): live Aseprite if connected, else headless batch |
blendMode | string | |
color | Default color for shapes without one | |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
opacity | integer | Opacity of the whole drawing when composited |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
width | number | Default stroke width |
link_cels
Links cels so several frames share one image (edits to one show in all), or unlinks them. Linking needs live mode. Unlinking works in both modes.
| Parameter | Type | Description |
|---|---|---|
action | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
layers | array | Several layers at once |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
palette_edit
Edits the palette structure: add or insert colors, remove entries, move entries, sort (by hue, saturation, value, lightness, luminance, red, green, blue, alpha), reverse a range, generate a ramp between two colors, or dedupe. In indexed sprites pixels are remapped so they keep their colors (set remapPixels=false to skip); pixels using removed colors move to the nearest remaining one.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
at | integer | insert/ramp: target index (default end) |
backend | string | auto (default): live Aseprite if connected, else headless batch |
by | string | |
colors | array | add/insert |
descending | boolean | |
from | integer | Range start for remove/move/sort/reverse |
fromColor | ramp start | |
indices | array | remove/move: entries to act on |
insert | boolean | ramp: insert instead of overwriting entries |
remapPixels | boolean | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
space | string | ramp interpolation (default rgb) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
steps | integer | |
to | integer | Range end, or the destination index for move |
toColor | ramp end |
view_settings
Reads or changes per-sprite view settings: grid (show, snap, bounds, color, opacity), pixel grid, symmetry mode and axes, tiled mode, onion skin, overlays (layer edges, selection edges, slices, auto guides, tile numbers, brush preview), checkerboard colors; and in live mode zoom, scroll, fit to screen, playback, timeline and preview window. Call with no options to read them.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
background | object | Checkerboard behind transparent pixels |
fitScreen | boolean | Live: zoom to fit |
grid | object | |
onionSkin | object | |
pixelGrid | object | |
playback | string | Live: start/stop animation playback (toggles) |
scroll | Live: sprite pixel to center the editor on | |
show | object | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
symmetry | object | |
tiledMode | string | |
timeline | boolean | Live: open (true) or close (false) the timeline |
togglePreview | boolean | Live: show/hide the preview window |
zoom | number | Live: editor zoom (1 = 100%) |
clipboard
Reads or writes the system clipboard: info, get_text, set_text, clear, get_image (returned as a preview image, or saved to 'file'), set_image (from an image file, or a rendered sprite frame/layer/rect).
| Parameter | Type | Description |
|---|---|---|
action * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
file | string | get_image: save here; set_image: load from here |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
rect | object | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
text | string |
duplicate_sprite
Makes a copy of a whole sprite (all layers, frames, tags, slices). In batch mode 'file' is required.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
file | string | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. |
properties
Gets, sets, deletes or replaces custom properties on a sprite, layer, cel, tag, slice, tileset or tile. With pluginKey ('publisher/extension') it reads/writes that extension's properties instead of the user properties.
| Parameter | Type | Description |
|---|---|---|
action | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
index | integer | Tile index for target=tile |
keys | array | delete: property names |
layer | Layer name, 'Group/Child' path, or 1-based index from get_sprite_info. Defaults to the active layer. | |
pluginKey | string | |
save | boolean | Batch mode: write changes back to the sprite file (default true) |
slice | ||
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | ||
target | string | |
tileset | ||
values | object |
recent_events
Live mode: returns what happened in Aseprite since a sequence number: sprite changes (including undo/redo), switching sprite/layer/frame, commands run, and color changes. Events caused by MCP calls are hidden unless includeMcp is true. Pass the returned lastSeq as 'since' next time.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
includeMcp | boolean | |
limit | integer | |
since | integer | |
types | array |
ask_user
Live mode: shows a dialog in Aseprite and waits for the user to answer. Can show text plus input fields (entry, number, slider, check, combobox, color, label) and buttons. Returns the pressed button and field values.
| Parameter | Type | Description |
|---|---|---|
buttons | array | Default ['OK', 'Cancel'] |
fields | array | |
text | string | |
timeoutSeconds | number | Close the dialog and return timedOut=true after this many seconds (default 300) |
title | string |
render_preview
Renders frames as an image you can look at (nearest-neighbor upscaled, transparency shown as a checkerboard). Multiple frames are laid out in a grid in frame order. Use this after edits to check the result.
| Parameter | Type | Description |
|---|---|---|
backend | string | auto (default): live Aseprite if connected, else headless batch |
checkerboard | boolean | |
columns | integer | |
crop | object | Only this area of the rendered strip |
frame | integer | 1-based frame number. Defaults to the active frame (or 1). |
frames | 'all' or a list of frame numbers | |
from | integer | First frame of a range |
layer | Render only this layer (default: all visible layers) | |
maxSize | integer | Longest side of the preview (default 512) |
pixelGrid | boolean | Faint lines between pixels at high zoom (default true) |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | Use the frames of this tag |
to | integer | Last frame of a range |
export
Exports a copy of the sprite to any format (png, gif, webp, jpg, bmp, tga, pcx, ico, qoi, flc, svg, css, ...). Options: scale, a tag or a 1-based frame range, a slice, specific layers, or a filename template like 'out_{frame}.png' ({frame} counts from 0). Single-image formats with several frames get one file per frame (name1.png, name2.png..., or starting from a trailing number in the name); the result lists every file written.
| Parameter | Type | Description |
|---|---|---|
file * | string | |
aniDir | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
bounds | object | |
filenameFormat | string | |
fromFrame | integer | |
ignoreEmpty | boolean | |
layers | array | Export only these layers |
playSubtags | boolean | |
scale | number | |
slice | string | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | |
toFrame | integer |
export_sprite_sheet
Exports a sprite sheet image plus optional JSON data (File > Export Sprite Sheet). Supports layouts, padding, trimming, extrusion, splitting by layers/tags, tilesets, and listing layers/tags/slices in the JSON.
| Parameter | Type | Description |
|---|---|---|
textureFilename * | string | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
borderPadding | integer | |
columns | integer | |
dataFilename | string | |
dataFormat | string | |
extrude | boolean | |
filenameFormat | string | |
fromTilesets | boolean | |
height | integer | |
ignoreEmpty | boolean | |
innerPadding | integer | |
layer | string | |
listLayers | boolean | |
listSlices | boolean | |
listTags | boolean | |
mergeDuplicates | boolean | |
powerOfTwoSize | boolean | |
rows | integer | |
shapePadding | integer | |
splitGrid | boolean | |
splitLayers | boolean | |
splitTags | boolean | |
sprite | File path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path. | |
tag | string | |
tagnameFormat | string | |
trim | boolean | |
trimByGrid | boolean | |
trimSprite | boolean | |
type | string | |
width | integer |
import_sprite_sheet
Opens an image and slices it into frames (File > Import Sprite Sheet). Optionally saves the result.
| Parameter | Type | Description |
|---|---|---|
file * | string | |
frameHeight * | integer | |
frameWidth * | integer | |
backend | string | auto (default): live Aseprite if connected, else headless batch |
padding | ||
partialTiles | boolean | |
saveAs | string | Save the imported sprite here (needed in batch mode) |
type | string | |
x | integer | |
y | integer |