Trying to make a script to flip normal maps, can't figure how to do the flip part

Now that I tried the script in full, that error message showed up for me… one of the reasons I try to avoid commands :slight_smile: . See if this hack of inverting the mask twice works.

local lay = app.layer
if not lay then return app.alert "There is no active layer" end

app.transaction("Flip Normal Map", function()
    app.command.Flip {
        target = "mask",
        orientation = "vertical"
    }

    app.command.InvertMask()
    app.command.InvertMask()

    app.command.InvertColor {
        ui = false,
        channels = FilterChannels.RED,
    }

    app.command.InvertMask()
    app.command.InvertMask()
end)

app.refresh()