Example Lua Filter

Here is an example of a Lua Script Filter that does a simple invert (negative).

for y = 0, height - 1 do
  for x = 0, width - 1 do
    local r, g, b
    r, g, b = get_rgb(x, y)
    r = 1 - r
    g = 1 - g
    b = 1 - b
    set_rgb(x, y, r, g, B)
  end
end