image processing - ImageMagick - alpha channel extract, different results (darker) on 6.7 vs 6.9 -


i'm working in cross-platform environment results of same, simple alpha channel extraction operation different between imagemagick 6.7.7-10 , imagemagick 6.9.3-7.

the command extract alpha channel is:

convert image.png -alpha extract alpha.png 

or equivalently: convert image.png -channel -separate alpha.png

here original, 6.7 output, , 6.9 output:

enter image description here

testing original in gimp, in middle of top dark bar, can see original alpha value 80% or 204:

enter image description here

the 6.9 output has grayscale value of 204, while 6.7 output has grayscale value of 154.

now question: believe 6.9 version correct, visual result provided 6.7 version. can understand how 6.7 version working (maybe different formula / luminence / color space?) , same result 6.9 version? maybe apply curve 6.9 output? or switch make use different formula / color space? (do color spaces apply pngs?)

post processing 6.9 output simple gamma adjustment gives close approximation of 6.7 output:

convert /tmp/alpha_channel_6.9.png -gamma 0.4472 /tmp/alpha_gamma_0.4472.png 

here's gist of our solution in shell script detect 6.7 , apply gamma adjustment selectively.


note: compared -fx answer, gamma adjustment runs faster more accurate, judging less statistical error (mae of 190 vs 408) found with:

compare -verbose -metric mae /tmp/alpha_channel_6.7.png /tmp/alpha_curved.png null: 2>&1 compare -verbose -metric mae /tmp/alpha_channel_6.7.png /tmp/alpha_gamma_0.4472.png null: 2>&1 

but i'm going leave -fx answer in place, because process of finding curves describes.


incidentally, command lightens 6.7 output 6.9 output:

convert /tmp/alpha_channel_6.7.png -gamma 2.22 /tmp/alpha_gamma_to_look_like_6.9.png 

but such big gamma boost, results pretty ugly color banding in dark areas:

enter image description here


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -