Compositor
v0.1.4Read and edit Compositor .comp projects: layers, folders, masks, transforms, previews and exports
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
inspect_project Inspect project
Reads a Compositor .comp project and returns the canvas info plus every layer in stacking order (bottom to top), with folder depth, visibility, opacity, blend mode and transform.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the .comp project package (a directory ending in .comp) |
list_layers List layers
Compact list of layers (id, name, kind, visibility) from top to bottom as shown in Compositor's Layers panel.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the .comp project package (a directory ending in .comp) |
render_preview Render preview
Flattens the project and returns a PNG preview image so the model can see the composition. Optionally saves it to a file. Clipping masks, adjustment layers and layer effects are not rendered; the response lists what was skipped.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the .comp project package (a directory ending in .comp) |
maxSize | integer | Longest side of the preview in pixels |
outputPath | string | If given, also writes the preview (PNG or JPEG by extension) to this path |
export_flattened Export flattened image
Renders the whole project at full resolution to a PNG or JPEG file.
| Parameter | Type | Description |
|---|---|---|
outputPath * | string | Destination file; .png keeps transparency, .jpg flattens onto white |
path * | string | Path to the .comp project package (a directory ending in .comp) |
quality | integer | JPEG quality |
export_layer Export a layer's pixels
Copies a pixel layer's source PNG (untransformed, original resolution) or its mask to a file.
| Parameter | Type | Description |
|---|---|---|
layer * | string | Layer UUID or its exact name |
outputPath * | string | |
path * | string | Path to the .comp project package (a directory ending in .comp) |
what | string |
create_project Create project
Creates a new empty .comp project. Optionally adds a solid background layer. Overwrites the manifest of an existing package at that path.
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
path * | string | Path to the .comp project package (a directory ending in .comp) |
width * | integer | |
background | string | CSS color for a Background layer, e.g. #ffffff. Omit for a transparent document. |
resolution | number | Pixels per inch (default 72) |
add_image_layer Add image layer
Imports an image file (PNG, JPEG, HEIC, TIFF, WebP…) as a new pixel layer. The pixels are stored as-is; the placement only sets the layer's transform.
| Parameter | Type | Description |
|---|---|---|
imagePath * | string | Image file to import |
path * | string | Path to the .comp project package (a directory ending in .comp) |
above | string | Place directly above this layer (id or name) |
below | string | Place directly below this layer (id or name) |
blendMode | string | |
name | string | Layer name (defaults to the file name) |
opacity | number | |
origin | array | Explicit top-left position in canvas pixels; overrides centering |
parent | string | Folder (id or name) to put the layer in; omit for the root |
placement | string | original: 1:1 pixels centered; fit: scale to fit inside the canvas; fill: scale to cover the canvas; stretch: match canvas size |
size | array | Explicit display size in canvas pixels; overrides placement |
add_folder Add folder
Creates an empty layer folder (group).
| Parameter | Type | Description |
|---|---|---|
name * | string | |
path * | string | Path to the .comp project package (a directory ending in .comp) |
above | string | Place directly above this layer (id or name) |
below | string | Place directly below this layer (id or name) |
parent | string | Folder (id or name) to put the layer in; omit for the root |
set_layer Set layer properties
Changes name, visibility, opacity, blend mode, mask enablement or transform (origin, size, rotation, flips) of a layer. Only the given fields change.
| Parameter | Type | Description |
|---|---|---|
layer * | string | Layer UUID or its exact name |
path * | string | Path to the .comp project package (a directory ending in .comp) |
active | boolean | Make it the selected layer in Compositor |
blendMode | string | |
flipX | boolean | |
flipY | boolean | |
maskEnabled | boolean | |
name | string | |
opacity | number | |
origin | array | Top-left in canvas pixels |
rotation | number | Clockwise degrees |
sampling | string | |
size | array | Display size in canvas pixels; source pixels are untouched |
visible | boolean |
move_layer Move layer in the stack
Reorders a layer (with its subtree if it is a folder): to the top or bottom of a folder or the root, or directly above/below another layer.
| Parameter | Type | Description |
|---|---|---|
layer * | string | Layer UUID or its exact name |
path * | string | Path to the .comp project package (a directory ending in .comp) |
above | string | Place directly above this layer (id or name) |
below | string | Place directly below this layer (id or name) |
parent | string | Folder (id or name) to put the layer in; omit for the root |
to | string | Top or bottom of the destination folder (or root) |
remove_layer Remove layer
Deletes a layer (and, for a folder, everything inside it) together with its image and mask files.
| Parameter | Type | Description |
|---|---|---|
layer * | string | Layer UUID or its exact name |
path * | string | Path to the .comp project package (a directory ending in .comp) |
replace_layer_image Replace layer pixels
Swaps the source pixels of a pixel layer with another image file, keeping its transform, mask and properties. Use it to round-trip a layer through an external editor or a generated image.
| Parameter | Type | Description |
|---|---|---|
imagePath * | string | |
layer * | string | Layer UUID or its exact name |
path * | string | Path to the .comp project package (a directory ending in .comp) |
keepDisplaySize | boolean | true keeps the on-canvas size; false shows the new image 1:1 |
set_layer_mask Set or clear a layer mask
Attaches a raster mask from a grayscale image (white reveals, black hides) to a layer, or removes the existing mask. The mask is stretched over the layer's own rectangle.
| Parameter | Type | Description |
|---|---|---|
layer * | string | Layer UUID or its exact name |
path * | string | Path to the .comp project package (a directory ending in .comp) |
invert | boolean | |
maskPath | string | Grayscale or any image; luminance becomes coverage. Omit to clear the mask. |
resize_canvas Resize canvas
Changes the document size without resampling layers. Layers keep their pixels and are offset according to the anchor.
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
path * | string | Path to the .comp project package (a directory ending in .comp) |
width * | integer | |
anchor | string |
open_in_compositor Open in Compositor
Opens (or reloads) the project in the Compositor app on this Mac so the user can see the result. Compositor reads the package from disk on open.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to the .comp project package (a directory ending in .comp) |