Unable to rotate exactly 90 degrees

Aseprite v1.3-beta10-x64, Steam, Windows

Even with Edit>Rotate>90 CW/CCW it’s rotating ever so slightly off, I’ve tried both “Fast Rotation” and “Rotsprite” and both seem to have the same problem where it’s still pixels off. I’ve also tried rotating it manually with shift and it’s still not quite right. It says it’s 90 degrees in the display on the top, but the pixels themselves are noticeably not right.

Love this program, just wish I could use the rotation :’)

2 Likes

Hi @chronic-rose,

Welcome aboard. This issue has been reported here.

I believe it impacts the beta branch, but not the stable branch (1.2.32).

If you’d like to use a Lua script as a workaround, the following rotates the active cel image 90 degrees counter-clockwise.

local source = app.activeImage
if source then

    -- Cache pixels from source image.
    local px = {}
    local i = 1
    local srcPxItr = source:pixels()
    for elm in srcPxItr do
        px[i] = elm()
        i = i + 1
    end

    -- Rotate image (x = j % w, y = j // w)
    -- into new pixel array.
    local w = source.width
    local h = source.height
    local len = #px
    local lennh = len - h
    local pxRot = {}
    for j = 0, len - 1, 1 do
        pxRot[1 + lennh + (j // w) - (j % w) * h] = px[1 + j]
    end

    -- Transfer pixels to new image.
    local k = 1
    local target = Image(h, w, source.colorMode)
    local trgPxItr = target:pixels()
    for elm in trgPxItr do
        elm(pxRot[k])
        k = k + 1
    end

    -- Reassign new image.
    local sourceCel = source.cel
    sourceCel.image = target

    -- Center the cel.
    local celPos = sourceCel.position
    local xSrcHalf = w * 0.5
    local ySrcHalf = h * 0.5
    sourceCel.position = Point(
        celPos.x + xSrcHalf - ySrcHalf,
        celPos.y + ySrcHalf - xSrcHalf)
end

The center is treated as a pivot. Scripts can be assigned shortcuts with Edit > Keyboard Shortcuts. I realize this is far less convenient than a built-in method.

Best to you,
Jeremy

1 Like

@behreandtjeremy thank you for your reply! I will consider using this. I apologize for not searching elsewhere for the solution as it had not occurred to me. I did try searching here but could not find the right solution. thank you again for your help!

1 Like

The issue is still there → Steam BetaBranch 1.3-beta21

1 Like