Skip to content
firstmiddlelast edited this page Aug 27, 2023 · 8 revisions

Welcome to the libresprite-extensions wiki!

It contains scripting documentation gathered from the LibreSprite source code at https://github.com/LibreSprite/LibreSprite/tree/master/src/app/script/api. The global objects from which to start writing scripts are app and console.

LibreSprite can also be called from the command line, and has the following options :

Usage:
  libresprite.exe [OPTIONS] [FILES]...

Options:
      --palette <filename>     Use a specific palette by default
      --shell                  Start an interactive console to execute scripts
  -b, --batch                  Do not start the UI
      --save-as <filename>     Save the last given document with other format
      --scale <factor>         Resize all previous opened documents
      --shrink-to width,height Shrink each sprite if it is larger than width or height
      --data <filename.json>   File to store the sprite sheet metadata
      --format <format>        Format to export the data file (json-hash, json-array)
      --sheet <filename.png>   Image file to save the texture
      --sheet-width <pixels>   Sprite sheet width
      --sheet-height <pixels>  Sprite sheet height
      --sheet-type <type>      Algorithm to create the sprite sheet:
                                 horizontal
                                 vertical
                                 rows
                                 columns
                                 packed
      --sheet-pack             Same as --sheet-type packed
      --split-layers           Import each layer of the next given sprite as a separated image in the sheet
      --layer <name> or
      --import-layer <name>    Include just the given layer in the sheet
      --all-layers             Make all layers visible. By default hidden layers will be ignored
      --frame-tag <name>       Include tagged frames in the sheet
      --frame-range from,to    Only export frames in the [from,to] range
      --ignore-empty           Do not export empty frames/cels
      --border-padding <value> Add padding on the texture borders
      --shape-padding <value>  Add padding between frames
      --inner-padding <value>  Add padding inside each frame
      --trim                   Trim all images before exporting
      --crop x,y,width,height  Crop all the images to the given rectangle
      --filename-format <fmt>  Special format to generate filenames
      --script <filename>      Execute a specific script
      --list-layers            List layers of the next given sprite or include layers in JSON data
      --list-tags              List tags of the next given sprite sprite or include frame tags in JSON data
  -v, --verbose                Explain what is being done
      --debug                  Extreme verbose mode and copy log to desktop
  -?, --help                   Display this help and exits
      --version                Output version information and exit

Clone this wiki locally