SCRIPTING.md
palette: read-only. Returns the sprite's palette.selection: Placeholder. Do not use.height: read+write. Returns and sets the height of the sprite.width: read+write. Returns and sets the width of the sprite.filename: read-only. Returns the file name of the sprite.colorMode: read-only. Returns the sprite's ColorMode.layerCount: read-only. Returns the amount of layers in the sprite.loadPalette(fileName):
crop(x, y, width, height):
saveAs(fileName, asCopy):
resize(width, height):
save():
returns: Nothing
saves the sprite.
commit():
returns: Nothing
commits the current transaction.
layer(layerNumber):
decodeBase64():
returns: Nothing
get():
returns: Nothing
save():
returns: Nothing
set():
returns: Nothing
fetch():
returns: Nothing
load():
returns: Nothing
unload():
returns: Nothing
selected:id:addPalette():
returns: NothinggrayaA(color):
grayaV(color):
rgbaA(color):
graya(gray, alpha):
rgba(r, g, b, a):
rgbaG(color):
rgbaB(color):
rgbaR(color):
text:id:flags: read-only. Returns all flags OR'd together as an intisContinuous: read-only. Prefer to link cels when the user copies them.celCount: read-only. Returns the number of cels.isMovable: read-only. Returns true if the layer is movable.isVisible: read+write. Gets/sets whether the layer is visible or not.isTransparent: read-only. Returns true if the layer is a non-background image layer.isBackground: read-only. Returns true if the layer is a background layer.isImage: read-only. Returns true if the layer is an image, false if it is a folder.isEditable: read+write. Gets/sets whether the layer is editable (unlocked) or not (locked).name: read+write. The name of the layer.cel(index):
value:min:max:id:format: read-only. The PixelFormat of the image.stride: read-only. The number of bytes per image row.height: read-only. The height of the image.width: read-only. The width of the image.putPixel(x, y, color):
getImageData():
returns: All pixels in a Uint8Array
creates an array containing all of the image's pixels.
putImageData(data):
getPNGData():
returns: The image as a Base64-encoded PNG string.
Encodes the image as a PNG.
clear(color):
getPixel(x, y):
canClose: write only. Determines if the user can close the dialog window.title: read+write. Sets the title of the dialog window.id:addBreak():
returns: Nothing
addPaletteListBox():
returns: Nothing
addEntry():
returns: Nothing
addButton():
returns: Nothing
add():
returns: Nothing
close():
returns: Nothing
addLabel():
returns: Nothing
addDropDown():
returns: Nothing
addIntEntry():
returns: Nothing
get():
returns: Nothing
assert():
returns: Nothing
log():
returns: Nothing
text:id:Zoom():
returns: Nothing
Zoom in
ToggleFullscreen():
returns: Nothing
Toggle Fullscreen
Timeline():
returns: Nothing
Switch Timeline
TiledMode():
returns: Nothing
Tiled Mode
SymmetryMode():
returns: Nothing
Symmetry Mode
SpriteSize():
returns: Nothing
Sprite Size
SnapToGrid():
returns: Nothing
Snap to Grid
ShowLayerEdges():
returns: Nothing
Show Layer Edges
TogglePreview():
returns: Nothing
Toggle Preview
ShowGrid():
returns: Nothing
Show Grid
ShowExtras():
returns: Nothing
Show Extras
ShowBrushPreview():
returns: Nothing
Show Brush Preview
Share():
returns: Nothing
Share
SetSameInk():
returns: Nothing
Same Ink in All Tools
SetInkType():
returns: Nothing
Set Ink Type: Simple Ink
SetColorSelector():
returns: Nothing
Set Color Selector: Color Spectrum
SelectionAsGrid():
returns: Nothing
Selection as Grid
SelectTile():
returns: Nothing
Select Tile
Scroll():
returns: Nothing
Scroll 0 pixels left
SavePalette():
returns: Nothing
Save Palette
SaveFileCopyAs():
returns: Nothing
Save File Copy As
SaveFileAs():
returns: Nothing
Save File As
SaveFile():
returns: Nothing
Save File
SetLoopSection():
returns: Nothing
Set Loop Section
RunScript():
returns: Nothing
Run Script
ReverseFrames():
returns: Nothing
Reverse Frames
ReselectMask():
returns: Nothing
Reselect Mask
RescanScripts():
returns: Nothing
Rescan Scripts
ReplaceColor():
returns: Nothing
Replace Color
RepeatLastExport():
returns: Nothing
Repeat Last Export
PlayAnimation():
returns: Nothing
Play Animation
PixelPerfectMode():
returns: Nothing
Switch Pixel Perfect Mode
Options():
returns: Nothing
Options
OpenFile():
returns: Nothing
Open Sprite
NewSpriteFromSelection():
returns: Nothing
New Sprite From Selection
MaskByColor():
returns: Nothing
Mask By Color
NewFrameTag():
returns: Nothing
New Frame Tag
NewFile():
returns: Nothing
New File
UndoHistory():
returns: Nothing
Undo History
GotoNextLayer():
returns: Nothing
Go to Next Layer
NewBrush():
returns: Nothing
New Brush
OpenInFolder():
returns: Nothing
Open In Folder
ClearCel():
returns: Nothing
Clear Cel
MoveMask():
returns: Nothing
Move Selection Boundaries 0 pixels left
FrameTagProperties():
returns: Nothing
Frame Tag Properties
AddColor():
returns: Nothing
Add Foreground Color to Palette
MoveCel():
returns: Nothing
Move Cel
MergeDownLayer():
returns: Nothing
Merge Down Layer
MaskAll():
returns: Nothing
Mask All
SaveMask():
returns: Nothing
Save Mask
LoadMask():
returns: Nothing
LoadMask
LayerProperties():
returns: Nothing
Layer Properties
LayerFromBackground():
returns: Nothing
Layer From Background
SetPaletteEntrySize():
returns: Nothing
Set Palette Entry Size
Launch():
returns: Nothing
Launch
KeyboardShortcuts():
returns: Nothing
Keyboard Shortcuts
InvertMask():
returns: Nothing
Invert Mask
InvertColor():
returns: Nothing
Invert Color
GridSettings():
returns: Nothing
Grid Settings
GotoPreviousTab():
returns: Nothing
Go to Previous tab
ScrollCenter():
returns: Nothing
Scroll to center of canvas
GotoPreviousLayer():
returns: Nothing
Go to Previous Layer
GotoPreviousFrameWithSameTag():
returns: Nothing
Go to Previous Frame with same tag
GotoPreviousFrame():
returns: Nothing
Go to Previous Frame
GotoNextTab():
returns: Nothing
Go to Next Tab
AutocropSprite():
returns: Nothing
Trim Sprite
ImportSpriteSheet():
returns: Nothing
Import Sprite Sheet
ShowPixelGrid():
returns: Nothing
Show Pixel Grid
Home():
returns: Nothing
Home
UnlinkCel():
returns: Nothing
Unlink Cel
GotoNextFrameWithSameTag():
returns: Nothing
Go to Next Frame with same tag
CropSprite():
returns: Nothing
Crop Sprite
GotoLastFrame():
returns: Nothing
Go to Last Frame
OpenWithApp():
returns: Nothing
Open With Associated Application
GotoFirstFrame():
returns: Nothing
Go to First Frame
RemoveFrameTag():
returns: Nothing
Remove Frame Tag
NewFrame():
returns: Nothing
New Frame
FullscreenPreview():
returns: Nothing
Fullscreen Preview
SpriteProperties():
returns: Nothing
Sprite Properties
NewLayer():
returns: Nothing
New Layer
FrameProperties():
returns: Nothing
Frame Properties
DeselectMask():
returns: Nothing
Deselect Mask
AlternateTouchbar():
returns: Nothing
Alternate Touchbar
ExportSpriteSheet():
returns: Nothing
Export Sprite Sheet
NewLayerSet():
returns: Nothing
New Layer Set
ModifySelection():
returns: Nothing
Expand Selection
Paste():
returns: Nothing
Paste
DiscardBrush():
returns: Nothing
Discard Brush
BackgroundFromLayer():
returns: Nothing
BackgroundFromLayer
DuplicateView():
returns: Nothing
Duplicate View
About():
returns: Nothing
About
DeveloperConsole():
returns: Nothing
Developer Console
DuplicateSprite():
returns: Nothing
Duplicate Sprite
LinkCels():
returns: Nothing
Links Cels
CopyMerged():
returns: Nothing
Copy Merged
MaskContent():
returns: Nothing
Mask Content
DuplicateLayer():
returns: Nothing
Duplicate Layer
CopyCel():
returns: Nothing
Copy Cel
Refresh():
returns: Nothing
Refresh
Copy():
returns: Nothing
Copy
RemoveFrame():
returns: Nothing
Remove Frame
SetPalette():
returns: Nothing
Set Palette
OpenScriptsFolder():
returns: Nothing
Open Scripts Folder
FlattenLayers():
returns: Nothing
Flatten Layers
Eyedropper():
returns: Nothing
Eyedropper
PaletteSize():
returns: Nothing
Palette Size
ConvolutionMatrix():
returns: Nothing
Convolution Matrix
clearParameters():
returns: Nothing
Cut():
returns: Nothing
Cut
PaletteEditor():
returns: Nothing
Palette Editor
RemoveLayer():
returns: Nothing
Remove Layer
Clear():
returns: Nothing
Clear
Exit():
returns: Nothing
Exit
ColorQuantization():
returns: Nothing
Create Palette from Current Sprite (Color Quantization)
AlternateToolbar():
returns: Nothing
Alternate Toolbar
ChangeColor():
returns: Nothing
Color
ChangeBrush():
returns: Nothing
Brush
Cancel():
returns: Nothing
Cancel Current Operation
SwitchColors():
returns: Nothing
Switch Colors
ShowOnionSkin():
returns: Nothing
Show Onion Skin
ChangePixelFormat():
returns: Nothing
Change Pixel Format
ColorCurve():
returns: Nothing
Color Curve
PasteText():
returns: Nothing
Insert Text
CelProperties():
returns: Nothing
Cel Properties
Despeckle():
returns: Nothing
Despeckle
CloseAllFiles():
returns: Nothing
Close All Files
LoadPalette():
returns: Nothing
Load Palette
CanvasSize():
returns: Nothing
Canvas Size
Undo():
returns: Nothing
Undo
LayerVisibility():
returns: Nothing
Layer Visibility
Flip():
returns: Nothing
Flip Canvas Horizontal
Rotate():
returns: Nothing
Rotate Sprite 0°
Redo():
returns: Nothing
Redo
AlternateTimeline():
returns: Nothing
Alternate Timeline
ShowSelectionEdges():
returns: Nothing
Show Selection Edges
GotoFrame():
returns: Nothing
Go to Frame
CloseFile():
returns: Nothing
Close File
ToggleTouchbar():
returns: Nothing
Toggle Touchbar
GotoNextFrame():
returns: Nothing
Go to Next Frame
AdvancedMode():
returns: Nothing
Advanced Mode
setParameter():
returns: Nothing
value:maxsize:id:length:set():
returns: Nothing
get():
returns: Nothing
sprite:close():
returns: NothingBITMAP:INDEXED:GRAYSCALE:RGB:frame:image:y:x:setPosition():
returns: Nothingplatform: read-only. Returns one of: emscripten, windows, macos, android, linux.version: read-only. Returns LibreSprite's current version as a string.activeDocument: read-only. Returns the currently active Document.command: read-only. Returns an object with functions for running commands.activeSprite: read-only. Returns the currently active Sprite.activeLayerNumber: read-only. Returns the number of the current layer.activeImage: read-only, can be null. Returns the current layer/frame's image.pixelColor: read-only. Returns an object with functions for color conversion.activeFrameNumber: read-only. Returns the number of the currently active animation frame.launch():
returns: Nothing
open():
returns: Nothing
Opens a document for editing
yield(event):
createDialog():
returns: Nothing
Creates a dialog window
documentation():
returns: Nothing
Prints this text.
palette: read-only. Returns the sprite's palette.selection: Placeholder. Do not use.height: read+write. Returns and sets the height of the sprite.width: read+write. Returns and sets the width of the sprite.filename: read-only. Returns the file name of the sprite.colorMode: read-only. Returns the sprite's ColorMode.layerCount: read-only. Returns the amount of layers in the sprite.loadPalette(fileName):
crop(x, y, width, height):
saveAs(fileName, asCopy):
resize(width, height):
save():
returns: Nothing
saves the sprite.
commit():
returns: Nothing
commits the current transaction.
layer(layerNumber):
decodeBase64():
returns: Nothing
get():
returns: Nothing
save():
returns: Nothing
set():
returns: Nothing
fetch():
returns: Nothing
load():
returns: Nothing
unload():
returns: Nothing
selected:id:addPalette():
returns: NothinggrayaA(color):
grayaV(color):
rgbaA(color):
graya(gray, alpha):
rgba(r, g, b, a):
rgbaG(color):
rgbaB(color):
rgbaR(color):
text:id:flags: read-only. Returns all flags OR'd together as an intisContinuous: read-only. Prefer to link cels when the user copies them.celCount: read-only. Returns the number of cels.isMovable: read-only. Returns true if the layer is movable.isVisible: read+write. Gets/sets whether the layer is visible or not.isTransparent: read-only. Returns true if the layer is a non-background image layer.isBackground: read-only. Returns true if the layer is a background layer.isImage: read-only. Returns true if the layer is an image, false if it is a folder.isEditable: read+write. Gets/sets whether the layer is editable (unlocked) or not (locked).name: read+write. The name of the layer.cel(index):
value:min:max:id:format: read-only. The PixelFormat of the image.stride: read-only. The number of bytes per image row.height: read-only. The height of the image.width: read-only. The width of the image.putPixel(x, y, color):
getImageData():
returns: All pixels in a Uint8Array
creates an array containing all of the image's pixels.
putImageData(data):
getPNGData():
returns: The image as a Base64-encoded PNG string.
Encodes the image as a PNG.
clear(color):
getPixel(x, y):
canClose: write only. Determines if the user can close the dialog window.title: read+write. Sets the title of the dialog window.id:addBreak():
returns: Nothing
addPaletteListBox():
returns: Nothing
addEntry():
returns: Nothing
addButton():
returns: Nothing
add():
returns: Nothing
close():
returns: Nothing
addLabel():
returns: Nothing
addDropDown():
returns: Nothing
addIntEntry():
returns: Nothing
get():
returns: Nothing
assert():
returns: Nothing
log():
returns: Nothing
text:id:Zoom():
returns: Nothing
Zoom in
ToggleFullscreen():
returns: Nothing
Toggle Fullscreen
Timeline():
returns: Nothing
Switch Timeline
TiledMode():
returns: Nothing
Tiled Mode
SymmetryMode():
returns: Nothing
Symmetry Mode
SpriteSize():
returns: Nothing
Sprite Size
SnapToGrid():
returns: Nothing
Snap to Grid
ShowLayerEdges():
returns: Nothing
Show Layer Edges
TogglePreview():
returns: Nothing
Toggle Preview
ShowGrid():
returns: Nothing
Show Grid
ShowExtras():
returns: Nothing
Show Extras
ShowBrushPreview():
returns: Nothing
Show Brush Preview
Share():
returns: Nothing
Share
SetSameInk():
returns: Nothing
Same Ink in All Tools
SetInkType():
returns: Nothing
Set Ink Type: Simple Ink
SetColorSelector():
returns: Nothing
Set Color Selector: Color Spectrum
SelectionAsGrid():
returns: Nothing
Selection as Grid
SelectTile():
returns: Nothing
Select Tile
Scroll():
returns: Nothing
Scroll 0 pixels left
SavePalette():
returns: Nothing
Save Palette
SaveFileCopyAs():
returns: Nothing
Save File Copy As
SaveFileAs():
returns: Nothing
Save File As
SaveFile():
returns: Nothing
Save File
SetLoopSection():
returns: Nothing
Set Loop Section
RunScript():
returns: Nothing
Run Script
ReverseFrames():
returns: Nothing
Reverse Frames
ReselectMask():
returns: Nothing
Reselect Mask
RescanScripts():
returns: Nothing
Rescan Scripts
ReplaceColor():
returns: Nothing
Replace Color
RepeatLastExport():
returns: Nothing
Repeat Last Export
PlayAnimation():
returns: Nothing
Play Animation
PixelPerfectMode():
returns: Nothing
Switch Pixel Perfect Mode
Options():
returns: Nothing
Options
OpenFile():
returns: Nothing
Open Sprite
NewSpriteFromSelection():
returns: Nothing
New Sprite From Selection
MaskByColor():
returns: Nothing
Mask By Color
NewFrameTag():
returns: Nothing
New Frame Tag
NewFile():
returns: Nothing
New File
UndoHistory():
returns: Nothing
Undo History
GotoNextLayer():
returns: Nothing
Go to Next Layer
NewBrush():
returns: Nothing
New Brush
OpenInFolder():
returns: Nothing
Open In Folder
ClearCel():
returns: Nothing
Clear Cel
MoveMask():
returns: Nothing
Move Selection Boundaries 0 pixels left
FrameTagProperties():
returns: Nothing
Frame Tag Properties
AddColor():
returns: Nothing
Add Foreground Color to Palette
MoveCel():
returns: Nothing
Move Cel
MergeDownLayer():
returns: Nothing
Merge Down Layer
MaskAll():
returns: Nothing
Mask All
SaveMask():
returns: Nothing
Save Mask
LoadMask():
returns: Nothing
LoadMask
LayerProperties():
returns: Nothing
Layer Properties
LayerFromBackground():
returns: Nothing
Layer From Background
SetPaletteEntrySize():
returns: Nothing
Set Palette Entry Size
Launch():
returns: Nothing
Launch
KeyboardShortcuts():
returns: Nothing
Keyboard Shortcuts
InvertMask():
returns: Nothing
Invert Mask
InvertColor():
returns: Nothing
Invert Color
GridSettings():
returns: Nothing
Grid Settings
GotoPreviousTab():
returns: Nothing
Go to Previous tab
ScrollCenter():
returns: Nothing
Scroll to center of canvas
GotoPreviousLayer():
returns: Nothing
Go to Previous Layer
GotoPreviousFrameWithSameTag():
returns: Nothing
Go to Previous Frame with same tag
GotoPreviousFrame():
returns: Nothing
Go to Previous Frame
GotoNextTab():
returns: Nothing
Go to Next Tab
AutocropSprite():
returns: Nothing
Trim Sprite
ImportSpriteSheet():
returns: Nothing
Import Sprite Sheet
ShowPixelGrid():
returns: Nothing
Show Pixel Grid
Home():
returns: Nothing
Home
UnlinkCel():
returns: Nothing
Unlink Cel
GotoNextFrameWithSameTag():
returns: Nothing
Go to Next Frame with same tag
CropSprite():
returns: Nothing
Crop Sprite
GotoLastFrame():
returns: Nothing
Go to Last Frame
OpenWithApp():
returns: Nothing
Open With Associated Application
GotoFirstFrame():
returns: Nothing
Go to First Frame
RemoveFrameTag():
returns: Nothing
Remove Frame Tag
NewFrame():
returns: Nothing
New Frame
FullscreenPreview():
returns: Nothing
Fullscreen Preview
SpriteProperties():
returns: Nothing
Sprite Properties
NewLayer():
returns: Nothing
New Layer
FrameProperties():
returns: Nothing
Frame Properties
DeselectMask():
returns: Nothing
Deselect Mask
AlternateTouchbar():
returns: Nothing
Alternate Touchbar
ExportSpriteSheet():
returns: Nothing
Export Sprite Sheet
NewLayerSet():
returns: Nothing
New Layer Set
ModifySelection():
returns: Nothing
Expand Selection
Paste():
returns: Nothing
Paste
DiscardBrush():
returns: Nothing
Discard Brush
BackgroundFromLayer():
returns: Nothing
BackgroundFromLayer
DuplicateView():
returns: Nothing
Duplicate View
About():
returns: Nothing
About
DeveloperConsole():
returns: Nothing
Developer Console
DuplicateSprite():
returns: Nothing
Duplicate Sprite
LinkCels():
returns: Nothing
Links Cels
CopyMerged():
returns: Nothing
Copy Merged
MaskContent():
returns: Nothing
Mask Content
DuplicateLayer():
returns: Nothing
Duplicate Layer
CopyCel():
returns: Nothing
Copy Cel
Refresh():
returns: Nothing
Refresh
Copy():
returns: Nothing
Copy
RemoveFrame():
returns: Nothing
Remove Frame
SetPalette():
returns: Nothing
Set Palette
OpenScriptsFolder():
returns: Nothing
Open Scripts Folder
FlattenLayers():
returns: Nothing
Flatten Layers
Eyedropper():
returns: Nothing
Eyedropper
PaletteSize():
returns: Nothing
Palette Size
ConvolutionMatrix():
returns: Nothing
Convolution Matrix
clearParameters():
returns: Nothing
Cut():
returns: Nothing
Cut
PaletteEditor():
returns: Nothing
Palette Editor
RemoveLayer():
returns: Nothing
Remove Layer
Clear():
returns: Nothing
Clear
Exit():
returns: Nothing
Exit
ColorQuantization():
returns: Nothing
Create Palette from Current Sprite (Color Quantization)
AlternateToolbar():
returns: Nothing
Alternate Toolbar
ChangeColor():
returns: Nothing
Color
ChangeBrush():
returns: Nothing
Brush
Cancel():
returns: Nothing
Cancel Current Operation
SwitchColors():
returns: Nothing
Switch Colors
ShowOnionSkin():
returns: Nothing
Show Onion Skin
ChangePixelFormat():
returns: Nothing
Change Pixel Format
ColorCurve():
returns: Nothing
Color Curve
PasteText():
returns: Nothing
Insert Text
CelProperties():
returns: Nothing
Cel Properties
Despeckle():
returns: Nothing
Despeckle
CloseAllFiles():
returns: Nothing
Close All Files
LoadPalette():
returns: Nothing
Load Palette
CanvasSize():
returns: Nothing
Canvas Size
Undo():
returns: Nothing
Undo
LayerVisibility():
returns: Nothing
Layer Visibility
Flip():
returns: Nothing
Flip Canvas Horizontal
Rotate():
returns: Nothing
Rotate Sprite 0°
Redo():
returns: Nothing
Redo
AlternateTimeline():
returns: Nothing
Alternate Timeline
ShowSelectionEdges():
returns: Nothing
Show Selection Edges
GotoFrame():
returns: Nothing
Go to Frame
CloseFile():
returns: Nothing
Close File
ToggleTouchbar():
returns: Nothing
Toggle Touchbar
GotoNextFrame():
returns: Nothing
Go to Next Frame
AdvancedMode():
returns: Nothing
Advanced Mode
setParameter():
returns: Nothing
value:maxsize:id:length:set():
returns: Nothing
get():
returns: Nothing
sprite:close():
returns: NothingBITMAP:INDEXED:GRAYSCALE:RGB:frame:image:y:x:setPosition():
returns: Nothingplatform: read-only. Returns one of: emscripten, windows, macos, android, linux.version: read-only. Returns LibreSprite's current version as a string.activeDocument: read-only. Returns the currently active Document.command: read-only. Returns an object with functions for running commands.activeSprite: read-only. Returns the currently active Sprite.activeLayerNumber: read-only. Returns the number of the current layer.activeImage: read-only, can be null. Returns the current layer/frame's image.pixelColor: read-only. Returns an object with functions for color conversion.activeFrameNumber: read-only. Returns the number of the currently active animation frame.launch():
returns: Nothing
open():
returns: Nothing
Opens a document for editing
yield(event):
createDialog():
returns: Nothing
Creates a dialog window
documentation():
returns: Nothing
Prints this text.