-- copy image and invert w, h = img.width, img.height pixels = {} for y = 0, h-1 do for x = 0, w-1 do pixels[y*w+x+1] = 0xFFFFFF - img.getInt(x, y) end end