Slice tool: How does it work?

Hi…,

how does the slice tool work? I don’t find any documentation.

Cheers

Mike

1 Like

Hi @Mike, you can select the slice tool with C key. Then with Left click you create new slices and with right-click you can see the slice properties or remove it. Check this little video:

At the moment the animation support for slices is really poor, but it might be useful for static images (and to export slices to different files you can use the CLI)

4 Likes

Hi David,

ah, I understand now, it is for exporting sliced graphics, like buttons, etc. .Also I was missing the right click.

Thank you very much

Mike

2 Likes

Exactly! There is a little trick used by the default theme to auto-export/import slices into a XML file. For example, if your file is called sheet.png, you can create a sheet.aseprite-data with the following content:

<?xml version="1.0" encoding="utf-8"?>
<sprite>
  <slices />
</sprite>

And when you save the .png file the content of the XML file will be updated automatically to something like:

<?xml version="1.0" encoding="utf-8" ?>
<sprite>
    <slices>
        <slice id="Slice1" color="#0000ff">
            <key frame="0" x="4" y="15" w="11" h="11" />
        </slice>
        <slice id="Slice2" color="#0000ff">
            <key frame="0" x="3" y="5" w="3" h="7" />
        </slice>
    </slices>
</sprite>

Slices are saved internally in .ase files, but this trick might be useful to have a .png + XML information about slices. (In the future this .aseprite-data file might be updated with more information about the sprite, layers, frames, etc.)

1 Like

Hi David,

I work with Cocos Creator from Cocos2D-x, this has also 9-sliced graphics, but I haven’t needed it until now, perhaps in the future.

Thank you again

Mike

1 Like

Thank you for including this. I had accidentally created some slices on one of my files a while ago, and now I know how to remove them.

2 Likes