analog-film-emulator icon indicating copy to clipboard operation
analog-film-emulator copied to clipboard

Gamma encoded everywhere

Open Tegmen opened this issue 9 years ago • 1 comments
trafficstars

Why do you always work with gamma encoded data? Is the performance difference that big?

For example line 182 in image-processing.js let plum = (pmax + pmin) / 2; should imo be let plum = pow(pow(pmax,gamma) + pow(pmin,gamma), 1/ gamma) / 2;

The same for dithering. Photoshop does its dithering also gamma encoded, which leads to artefacts, especially when working with already dithered images. One might think that the difference is not noticeable , but this shows the difference.

// leave values gamma encoded, results are practically nicer

what do you mean, "nicer"? RGB to grayscale conversion is imo much more accurate when done unencoded, as this project demonstrates. However, you cant use [0.2126,0.7152,0.0722] any more when with unencoded data. I came up with [0.2,0.52,0.28] for unencoded data. Its not ideal, but much better than all the conversions that use gamma encoded RGB values.

Great project btw!

Tegmen avatar Jun 29 '16 08:06 Tegmen

Oh, sorry for missing this for so long.

Why do you always work with gamma encoded data? Is the performance difference that big?

As far as I remember and from what the comment suggests I tried to do the adjustments both in gamma and linear space and preferred the gamma way the sliders behaved when operating on the gamma encoded data. But I'm not entirely sure anymore

Ditherlicious does it's dithering operations in linear space. But it also matters a lot more when dithering down to 1 bit rather than 8. :)

jwagner avatar Nov 20 '16 23:11 jwagner