Converting premultiplied to non-premultiplied
Posted: Fri Sep 29, 2017 6:59 pm
Canvas:newImageData returns an image with premutliplied alpha. What is the best way to convert to an image that is not premultiplied? This is how I'm currently doing it:
Is there a better/easier/faster way to achieve this?
Code: Select all
local img = canvas:newImageData()
img:mapPixel(function(x, y, r, g, b, a)
return r / a * 255, g / a * 255, b / a * 255, a
end)