1
0
Fork 0
mirror of synced 2024-06-13 16:34:32 +12:00

Fix gamma correction

This commit is contained in:
nagadomi 2015-12-01 20:56:56 +09:00
parent 5cda0b71d7
commit 9727bba51a

View file

@ -58,7 +58,10 @@ function image_loader.decode_float(blob)
end
local gamma = math.floor(im:gamma() * 1000000) / 1000000
if gamma ~= 0 and gamma ~= gamma_lcd then
im:gammaCorrection(gamma / gamma_lcd)
local cg = gamma / gamma_lcd
im:gammaCorrection(cg, "Red")
im:gammaCorrection(cg, "Blue")
im:gammaCorrection(cg, "Green")
end
-- FIXME: How to detect that a image has an alpha channel?
if blob:sub(1, 4) == "\x89PNG" or blob:sub(1, 3) == "GIF" then