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.
Gamma correcting alpha channel only
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Gamma correcting alpha channel only
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...
this makes the matte channel an alpha, negates it and turns it back into a matte channel
try this...
Code: Select all
convert 0001.sgi -channel Alpha -negate -gamma 1.4 -negate test.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Gamma correcting alpha channel only
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.
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Gamma correcting alpha channel only
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?
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?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/