Page 1 of 1

Gamma correcting alpha channel only

Posted: 2007-07-30T02:10:32-07:00
by simon
Using the following command line on an image doesn't result in a correctly gamma corrected alpha channel in the output image.

convert 0001.sgi -channel Alpha -gamma 1.4 test.png

In fact it seems to produce the opposite of what it should, ie it makes the image darker not lighter. If I do -gamma 0.714 (which is 1/1.4) it gets closer but still performs very different to my other imaging package.

Maybe there is different algorithms for doing gamma correction? I thought there was only one.

Re: Gamma correcting alpha channel only

Posted: 2007-08-13T23:22:34-07:00
by anthony
The problem is that alpha channel in IM isn't an alpha channel. It is a matte channel whcih is a negated alpha channel

try this...

Code: Select all

   convert 0001.sgi -channel Alpha -negate -gamma 1.4 -negate test.png
this makes the matte channel an alpha, negates it and turns it back into a matte channel ;-)

Re: Gamma correcting alpha channel only

Posted: 2007-08-14T01:55:48-07:00
by simon
Close but still different. It now lightens instead of darkening but the result is still wrong. Ie when I comp the result I see a visible edge where the gamma of the edge pixels in the alpha channel doesn't match the gamma of the main image which was done in a 3D rendering package. I guess there must be different algorithms for gamma. Strange.

I have found another solution for this problem, but I'm still rather curious as to why the results are different in the two packages.

Re: Gamma correcting alpha channel only

Posted: 2007-08-15T16:50:45-07:00
by anthony
They should not be different, except to the effects of rounding.
The gamma function is quite well defined.

Is it only an edge that differs or the overall result?

Can you provide an example of the input, command used and the results from Im and the other package?