get("#372") -- getContrast _, _, min, max = getContrast(img) -- copy image and invert w, h = img.width, img.height pixels = {} for y = 0, h-1 do for x = 0, w-1 do b = bright(rgb(img.getInt(x, y))) n = math.max(0, math.min(255, math.floor((b-min)/(max-min)*255+0.5))) pixels[y*w+x+1] = n*0x010101 end end