Import Split Layer Spritesheets

I have a few projects saved out as sheets with like 20 frames and 30 layers. So I have a 20x30 grid of images, the same as you would get using the “Split Layers” option in the Spritesheet export.

If I import this by row I get 600 frames. Straight forward enough I can tediously drag each 20 frames into a new layer and call it a day. But I have a bunch of these and it’s tedious.

Is there any way I can bring this into aseprite with my 30 rows as layers?

I don’t know of any native way to do this, I can only say that I know that this can be done with a script:

local dialog = Dialog("Split to Layers")
dialog --
:number{id = "framesPerLayer", label = "Frames per Layer", decimals = 0} --
:separator() --
:button{
    text = "OK",
    onclick = function()
        app.transaction(function()
            local sprite = app.activeSprite
            local sourceLayer = app.activeLayer

            for newLayerIndex = 1, math.ceil(#sprite.cels /
                                                 dialog.data.framesPerLayer) do
                local newLayer = sprite:newLayer()
                newLayer.stackIndex = 0

                local skip = (newLayerIndex - 1) * dialog.data.framesPerLayer

                for i = 1, dialog.data.framesPerLayer do
                    local cel = sourceLayer:cel(skip + i)
                    if cel then
                        sprite:newCel(newLayer, i, cel.image, cel.position)
                    end
                end
            end

            sprite:deleteLayer(sourceLayer)

            for frameNumber = #sprite.frames, dialog.data.framesPerLayer + 1, -1 do
                sprite:deleteFrame(frameNumber)
            end
        end)
    end
} --
:button{text = "Cancel"} --
:show()
2 Likes

Thanks. That script works great.

1 Like