How can I save a sprite from another tab?

hi, again ;]
it seems like the script is incomplete, but assuming you call iterate_layers(_input_layer) later, then i think following happens:

  • if _input_layer is regular layer, nothing happens, because it doesn’t contain a stack of layers to loop through. only sprites and groups can have .layers.
  • if it is group, then it doesn’t have a cel with image (content) to create a selection from it. which shouldn’t matter in this case, however same happens if one of the layers is empty. or if one of layers is another, nested group.
  • and if there is no selection, then aseprite can’t create a file from it.
  • and finally, once aseprite didn’t create a new file, it saves the active file as png and then closes it. which probably will be the original file you actually want to keep open.

there are also other issues and possibly some more i don’t see.

anyway, i got you this: Export cropped layers
it’s nothing fancy, but it somewhat works.
the script may look long, but it really are just three blocks: setup with variables, main functionality and dialog window. the most important thing is happening again in familiar iterate_layers function, so if you want to experiment with it, start there.
hope it helps.

1 Like