Export

Spine can export a single image, sequence of images, video, and JSON or binary data.

To open the Export dialog, press ctrl+E (cmd+E on Mac) or click the Spine logo in the upper left of Spine and choose Export from the menu.

JSON

Spine can export all of the skeleton data as JSON. This data can then be loaded by a Spine runtime and displayed in your applications just as it is in Spine

JSON has some advantages over binary. Most changes to the Spine export format don't invalidate previously exported JSON data. JSON is also human readable and easy for code to parse. The downside is that JSON data is larger and parsing the data is slower.

See JSON Format for detailed information about the JSON data that is exported.

  • Output folder A JSON file will be created in this folder for each skeleton in your project. The name of the file will use the name of the skeleton.
  • Extension The JSON files will use this file extension.
  • Format Spine can optionally write in JSON-like formats that are slightly smaller, easier to read, and easier to edit.
  • JSON Standard JSON.
  • JavaScript Like JSON, but names are only quoted if necessary. The output is valid JavaScript.
  • Minimal Like JSON, but names and values are only quoted if they don't contain rnt or space and don't begin with /{}[]:,". Additionally, names cannot contain : and values cannot contain }],. This format requires a lenient JSON parser, such as the one in libgdx.
  • Pretty print When checked, the JSON is formatted nicely so it is more easily ready by humans. This makes the file slightly larger.
  • Nonessential data When checked, additional data is included in the JSON that is not needed to rendering the skeletons. This makes the file slightly larger. This data is needed if the JSON will be imported back into Spine. See Import for more information.
  • Animation clean up When checked, animation cleaned up is performed before export. This does not modify the project file.
  • Warnings When checked, Spine will show any warning messages after exporting.
  • Pack When checked, it packs either only the images used by attachments or each skeleton's images folder into a texture atlas. This is convenient but running the texture packer separately provides more control over the packing. See Texture Packing for more information.

Binary

Spine can export all of the skeleton data as binary. This data can then be loaded by a Spine runtime and displayed in your applications just as it is in Spine.

Binary has some advantages over JSON. It is smaller and fast to parse by code, but it is not human readable. The downside is that any changes to the Spine export format will invalidate any previously exported binary data, which then needs to be exported again.

See Binary Format for detailed information about the binary data that is exported.

  • Output folder A binary file will be created in this folder for each skeleton in your project. The name of the file will use the name of the skeleton.
  • Extension The binary files will use this file extension.
  • Nonessential data When checked, additional data is included in the binary data that is not needed to rendering the skeletons. This makes the file slightly larger. This data is needed if the binary data will be imported back into Spine. See Import for more information.
  • Animation clean up When checked, animation cleaned up is performed before export. This does not modify the project file.
  • Warnings When checked, Spine will show any warning messages after exporting.
  • Pack When checked, it packs either only the images used by attachments or each skeleton's images folder into a texture atlas. This is convenient but running the texture packer separately provides more control over the packing. See Texture Packing for more information.

GIF

Spine can export an animated GIF, making it easy to share on the Internet. GIF is an image format with only 256 colors and doesn't support translucency, so some loss of quality may occur.

  • Export type The type of export to perform.
    • Animations The current animation, all the animations, or an animation from the dropdown menu are exported as an animated GIF.
    • Current pose The current skeleton pose is exported as a static GIF.
  • Defaults Resets all the GIF settings to the defaults ones.
  • Preview Opens the preview panel for the export window.
  • Output type Either creates a single file, or a file per frame.
  • Output file The GIF file to write.
  • Animation repeat The number of times to play each animation.
  • Pause after The number of seconds to pause after playing each animation.
  • Bones If checked, skeleton bones will be rendered.
  • Images If checked, skeleton images will be rendered.
  • Others If checked, other skeleton elements such as paths will be rendered.
  • Linear filtering If checked, Linear filtering will be applied to the GIF.
  • Multisample AA The depth of multisample anti-aliasing to apply to the GIF.
  • Viewport crop If checked, it enables cropping the GIF to a custom dimension. The amount of X and Y offset of the cropping area can be specified in the fist two boxes next to it, the size of the area can be specified in pixels in the last two boxes of the row. Enabling this setting also allows to resize the box in the export preview by dragging the red corners.
  • Size The type of Resizing to perform.
    • Scale The relative scale of the GIF expressed in percentage compared to the Spine skeleton.
    • Fit When selected, the output GIF will fit within the specified pixel values.
      • Enlarge If checked, and the content is smaller that the expressed values, the content of the gif is proportionally stretched until one of the sides matches the expressed values.
      • Pad If checked, additional space is added to the GIF to match the expressed values.
  • Range If checked, the gif will use the specified numbers as the starting and ending frames.
  • Colors The maximum number of colors in the GIF.
  • Color dither The amount of dither to apply to the GIF colors. Dither disperses the colors to prevent hard edges.
  • Alpha threshold Alpha values below this value are treated as 0.
  • Alpha dither The amount of dither to apply to the GIF transparency. Dither disperses transparency to prevent hard edges.
  • Background The background color to use.
    • Transparent When checked, completely transparent pixels will be transparent instead of the background color. When unchecked, the specified color is used for the background of the GIF.
    • Matte Translucent pixels are made opaque using the matte color.
  • Quality Higher quality produces better colors but takes longer to export.
  • FPS The number of frames per second for the GIF animation. 50 generally provides the best results.
  • Forever When checked, the animation is looped continuously.
  • Include last frame When unchecked, the last frame of each animation is omitted. This is especially useful for looping animations that would usually repeat the first and last frame, resulting in the same frame exported twice when the option is unchecked.

JPEG

Spine can export JPEG images. JPEG is a lossy image format that does not support transparency, so some loss of quality may occur.

  • Type The type of export to perform.
  • Sequence The specified animations are each exported as a number of JPEG files.
  • Frame The current skeleton pose is exported as a single JPEG.
  • Animation Export only the current animation or export all animations at once.
  • Skins Export only the current skin or export all skins at once.
  • Output folder The folder to write the JPEG files.
  • Images If checked, skeleton images will be rendered.
  • Bones If checked, skeleton bones will be rendered.
  • Background The background color to use.
  • Quality Higher quality produces better images but the file sizes are larger.
  • FPS The number of frames per second for the JPEG sequence.
  • Create atlas When checked, the exported images packed into a texture atlas. This is convenient but running the texture packer separately provides more control over the packing. See Texture Packing for more information.

PNG

Spine can export PNG images. PNG is a lossless image format that supports transparency, so no loss of quality will occur.

  • Type The type of export to perform.
  • Sequence The specified animations are each exported as a number of PNG files.
  • Frame The current skeleton pose is exported as a single PNG.
  • Animation Export only the current animation or export all animations at once.
  • Skins Export only the current skin or export all skins at once.
  • Output folder The folder to write the PNG files.
  • Images If checked, skeleton images will be rendered.
  • Bones If checked, skeleton bones will be rendered.
  • Background If checked, a background color is used. If unchecked, the PNG background is transparent.
  • FPS The number of frames per second for the JPEG sequence.
  • Create atlas When checked, the exported images packed into a texture atlas. This is convenient but running the texture packer separately provides more control over the packing. See Texture Packing for more information.

AVI

Spine can export an AVI video file of the current animation.

  • Codec The codec to use to encode the AVI video.
  • Output file The AVI file to write.
  • Images If checked, skeleton images will be rendered.
  • Bones If checked, skeleton bones will be rendered.
  • Background The background color to use.
  • Quality For the JPEG-based codec, higher quality produces better images but the file sizes are larger.
  • FPS The number of frames per second for the AVI video.

MOV

Spine can export a QuickTime MOV video file of the current animation.

  • Codec The codec to use to encode the MOV video.
  • Output file The MOV file to write.
  • Images If checked, skeleton images will be rendered.
  • Bones If checked, skeleton bones will be rendered.
  • Background The background color to use.
  • Quality For the JPEG-based codec, higher quality produces better images but the file sizes are larger.
  • FPS The number of frames per second for the MOV video.

Command line

Export and texture packing can be run from the command line, for use with scripts and build servers. When run in this way, Spine starts, does one or more exports or texture packings, then exits.

Prerequisites

Both Spine and the Spine launcher must be version 2.1.00 or higher to perform command line export. Also, if some export parameters are not accepted, it could be those parameters were added in a later version. To update the Spine launcher, use the Spine license link which was emailed when Spine was purchased to download and reinstall Spine.

JSON and binary data export, import, texture packing, and texture unpacking can be performed on a headless machine. To export images or video, an OS windowing system and OpenGL are required.

Usage

Command line usage for export and texture packing:

  Editor: Spine [-hfkltv] [-x <host:port>] [-u <version>]
        [<project.spine>]
  Export: Spine [-i <path>[.spine|.json|.skel]] [-m] [-o <path>] -e <path>
  Import: Spine -i <path>[.spine|.json|.skel] -o <path>.spine -r <name>
Clean up: Spine -i <path>[.spine] -m
    Pack: Spine -i <path> -o <path> -p <name>
          Spine -i <path> -o <path> [-n <name>] -p <path>.json
    Info: Spine -i <path>[.spine|.json|.skel]

Editor:
-h, --help       Print this help message and exit.
-f, --force      Force download of the Spine update.
-k, --keys       Enable hotkey popups by default.
-l, --logout     Logout, removing activation code.
-t, --notimeout  Disable timeout when checking for and downloading updates.
-v, --version    Print version information and exit.
-x, --proxy      Proxy server to use when checking for and downloading updates.
-u, --update     The version number of the Spine update to load.
project.spine    Path to a Spine project file to open.

Export JSON, binary, images, or video:
-i, --input   Path to a folder, project, or data file. Overrides export JSON.
-m, --clean   Animation clean up is performed before export.
-o, --output  Path to write export file(s). Overrides export JSON.
-e, --export  Path to export settings JSON file.

Import JSON, binary, or a project's skeletons into another project:
-i, --input   Path to a folder, project, or data file to be imported.
-o, --output  Path to project file to import into. Created if nonexistent.
-s, --scale   Scale the project being imported.
-r, --import  Perform a skeleton import. The skeleton name may be omitted.

Animation clean up:
-i, --input   Path to project file or folder.
-m, --clean   Animation clean up is performed and the project is saved.

Texture atlas packing:
-i, --input   Path to folder of images to be packed.
-o, --output  Path to write texture atlas and PNG files.
-n, --name    Texture atlas name, the prefix for the atlas and PNG files.
-p, --pack    Texture atlas name or path to pack settings JSON file.

Texture atlas unpacking:
-i, --input   Path to folder of atlas images.
-o, --output  Path to write unpacked image files.
-c, --unpack  Path to texture atlas file.

Project information:
-i, --input   Path to project or data file.

Examples:
Spine --export /path/to/export.json
Spine --export "/path/with spaces/to/export.json"
Spine --input /path/to/project.spine --output /path/to/output/
      --export /path/to/export.json
Spine -i /path/to/project.spine -o /path/to/output/ -e /path/to/export.json
Spine -e /path/to/export1.json -e /path/to/export2.json
Spine -i /path/to/images/ -o /path/to/output/ --pack /path/to/pack.json
Spine -i /path/to/images/ -o /path/to/output/ -n name -p /path/to/pack.json
Spine -i /path/to/project1.spine -o /path/to/output/ -e /path/to/export1.json
      -i /path/to/project2.spine -e /path/to/export2.json -i /path/to/images/
      -o /path/to/output/ -p /path/to/pack.json
Spine -i /path/to/skeleton.json -o /path/to/project.spine -r skeletonName

The output folder is created if it does not exist. Multiple export, import, texture packing, etc can be specified, as seen in the examples. If a command fails, Spine returns a non-zero error code.

Project export

For JSON, binary, image, and video export, the input and output paths are optional. If specified, they override the input and/or output paths specified in the export settings JSON file. The input path is a path to a project, JSON, or binary file. The output path may be a file or folder, depending on the export settings. The export settings JSON file is created using Spine by clicking on the Save button at the bottom of the Export dialog.

If the "clean up" parameter is specified, animation cleaned up is performed before export. This does not modify the project file.

Project import

For project import, the input path is a project, JSON, or binary file. Alternatively, it can be a folder containing .spine, .json, or .skel files. The output path is a project file. If a scale is specified, the project's skeletons are scaled before they are imported.

If a project is imported into another project, all skeletons are imported. If a skeleton name is specified and only one skeleton is imported, then the skeleton is renamed. If multiple skeletons are imported, the skeleton name is ignored and the skeletons keep their existing names.

If a JSON or binary file is imported into a project and a skeleton name is specified, then the skeleton is renamed. If a skeleton name is not specified, the skeleton is named using the JSON or binary file name without the extension.

Animation clean up

For animation clean up, the input path is a project file or folder containing .spine files. Animation clean up is performed for every skeleton and animation in the project and the project file is updated.

Texture packing

For texture packing, the input and output paths are folder paths. The --pack or -p parameter is either the texture atlas name to use when writing output files or a path to a pack settings JSON file. The pack settings JSON file is created using Spine by clicking on the Save button at the bottom of the Texture Packer Settings dialog. The name of the JSON file without the file extension is used as the texture atlas name.

When texture packing occurs, the settings from the specified pack settings JSON file are used. If a texture atlas name is specified instead, then the default settings are used. These settings are overridden by settings defined in any pack.json files found in the input folders. See the Spine texture packer JSON Configuration for more information.

Texture unpacking

For texture unpacking, the input path is an atlas file and the output path is a folder where the unpacked images will be written.

Project information

For project information, the input path is a project file or folder containing .spine files. Information is output for each project file. This can useful to know what version of Spine a project was saved with, how many animations are in the project, and other information.

Windows

Spine for Windows comes with two executables: Spine.exe and Spine.com. The EXE file is a GUI application, it starts Spine without a console window and doesn't wait for Spine to exit. The COM file is a command line application, it directs Spine's output to a console window and waits for Spine to exit.

Either executable can be used for command line export, but generally the COM file is preferred. If the Spine installation folder is on the system path or is the current working directory, specifying Spine without an extension will always execute Spine.com. For example:

Spine -e C:\path\to\export.json

Mac

Command line export when using Spine for Mac is done by launching the Spine executable file directly rather than opening Spine.app. The executable is found inside Spine.app at Spine.app/Contents/MacOS/Spine. For example:

/Applications/Spine/Spine.app/Contents/MacOS/Spine -e /path/to/export.json

Linux

Command line export when using Spine for Linux is done by running the Spine.sh script. For example:

./Spine.sh -e /path/to/export.json

Next: Texture Packing Previous: Preview