PKGaspi / AsepriteScripts

My collection of Aseprite Scripts. Useful to make repetitive export patterns quicker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export Layers - Resize / Shrink Canvas to Best Fit Exported Layer Sprite

jjwall opened this issue · comments

I'm looking to use the export layers script if I can resize / shrink the canvas around each exported layer sprite to "best fit" the resultant sprite. I've played around with the script and somehow was successful in one attempt to do this, but haven't been able to recreate this result again.

For a concrete example of what I'm looking for, currently exported layer sprites use the default canvas size of the Aseprite project you're exporting from, i.e. here I'm using the Export Layers script on a 128x128px canvas and get the following output:

image

What I'm looking for is something akin to the following:

image

Notice the sizes of these png's fit the resultant layer sprites.

I thought I was able to achieve this by manipulating the script using this additional line:

app.command.CanvasSize{ ui=false, bounds=app.activeSprite.bounds } -- <---
sprite:saveCopyAs(filename)

However, I may have been leveraging an additional feature of the script unknowingly.