Sprite represents a complete sprite document with layers, frames, and all sprite properties.
Constructor
Sprite(width, height [, colorMode])
Width in pixels.
Height in pixels.
Color mode (default: RGB).
Sprite(spec)
Image specification.
Sprite(otherSprite)
Sprite to duplicate.
Sprite
Path to sprite file.
Properties
Unique sprite identifier.
File path of the sprite.
True if the sprite has unsaved changes.
Sprite width in pixels.
Sprite height in pixels.
Color mode (RGB, GRAYSCALE, or INDEXED).
Color space profile.
Image specification.
Current selection mask.
Collection of all frames.
Collection of palettes.
Array of root layers.
Array of all cels.
Array of all tags.
Array of all slices.
Collection of tilesets.
Background layer if it exists.
Transparent color index for indexed sprites.
Sprite bounds.
Grid bounds.
Pixel aspect ratio.
Sprite-level events.
Methods
sprite:resize(width, height)
New width.
New height.
sprite:crop(rectangle)
Crop bounds (uses selection if not specified).
sprite:saveAs(filename)
File path to save to.
sprite:saveCopyAs(filename)
File path to save to.
sprite:close()
Closes the sprite.sprite:loadPalette(filename)
Palette file path.
sprite:setPalette(palette)
Palette to set.
sprite:assignColorSpace(colorSpace)
Color space to assign.
sprite:convertColorSpace(colorSpace)
Color space to convert to.
sprite:flatten()
Flattens all layers into one.sprite:newLayer()
Creates and returns a new layer.sprite:newGroup()
Creates and returns a new layer group.sprite:deleteLayer(layer)
Layer object or layer name.
sprite:newFrame([frameNumber])
Frame position (default: adds at end).
sprite:newEmptyFrame([frameNumber])
Frame position (default: adds at end).
sprite:deleteFrame(frameNumber)
Frame to delete.
sprite:newCel(layer, frame [, image] [, position])
Target layer.
Target frame.
Image for the cel.
Cel position.
sprite:deleteCel(cel)
Cel to delete.
sprite:newTag(from, to)
Start frame.
End frame.
sprite:deleteTag(tag)
Tag object or tag name.
sprite:newSlice([bounds])
Initial slice bounds.
sprite:deleteSlice(slice)
Slice object or slice name.

