Example Lua Filter

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

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