Why is app.image always nil

I was trying to make a script, when I ran into this issue.

app.image is nil and I don’t know why since I have an image open.

local image = app.image

if image == nil then
    return app.alert("NO IMAGE IN APP")
end

for it in image:pixels() do
    local pixelValue = it() -- get pixel
    it(pixelValue)          -- set pixel
    print(it.x, it.y)       -- get pixel x,y coordinates
end

return app.alert("EXECUTED SUCCESSFULLY YAY!")

This is all the code.

it works for me in 1.3.9.2
however, it appears app.image exists only if there is image associated with layer and cel in focus. so, if you have empty layer or cel selected, there is no active image.

1 Like

This is weird, as there isn’t an empty layer, I will try updating aseprite.