I'm working in a cross-platform environment where the results of the same, simple alpha channel extraction operation are different between ImageMagick 6.7.7-10 and ImageMagick 6.9.3-7.
The command to extract the alpha channel is:
convert image.png -alpha extract alpha.png
Or equivalently: convert image.png -channel A -separate alpha.png
Here is the original, the 6.7 output, and the 6.9 output:
Testing the original in Gimp, in the middle of the top dark bar, I can see that the original alpha value was 80% or 204:
The 6.9 output has grayscale value of 204, while the 6.7 output has a grayscale value of 154.
Now the question: I believe the 6.9 version is correct, but we like the visual result provided by the 6.7 version. Can we understand how the 6.7 version was working (maybe some different formula / luminence / color space?) and get the same result from the 6.9 version? Maybe apply some curve to the 6.9 output? Or some switch to make it use a different formula / color space? (Do color spaces even apply to PNGs?)



Deprecated: The -gamma answer is faster and provides better results, but I'll leave the below info, as it could be useful for other problems needing a "curves" solution.
Ok, I was able to post-process my 6.9 alpha channel output with a curves function so that it very closely matches the 6.7 alpha channel output.
However, if someone has a more concise switch, let me know!
Long story short, here's the post processing step:
It uses convert's -fx filter to apply curves to make 6.9 alpha channel output look like 6.7:
One could figure out the inverse function, to make 6.7 look like 6.9, given enough motivation.
Note to my future self, here's waaay too many details about how to derive this function:
Ok, so there's a page on ImageMagick's website about achieving a "curves" effect. The fun part is, it uses gnuplot to fit a polynomial to the curves function that'd you'd normally see in Gimp or Photoshop.
So I had the idea that I could create a test image (note, it's white with alpha, so not easy to see), run it through 6.7 alpha extract and 6.9 alpha extract, and visually compare them (on separate layers) in Gimp:
Then poke around in the curves tool on the 6.9 layer to make it look exactly like the 6.7 image:
Ok, so I found the curve I want. Now luckily, in Gimp, if you hover over the curve plot, it tells you the coordinates of the cursor, so I can find the coordinates of my curve to fit with gnuplot (as described in the link above. Note, I had to convert from 0-255 to 0.0-1.0.)
Cut super gory details, see this screencap of the general idea.
Note that I updated the ImageMagick code to fit a 4th degree polynomial, as it gave a better fit than their 3rd degree for me:
This output:
-0.456633863737214*x^4 + 1.33965176221586*x^3 + -0.0837635742856742*x^2 + 0.199687083827961*x +0.00105015974839925
Ok, I used the above to generate a function of X, and plotted it using desmos.com, then screencapped that plot (in red) to overlay and compare it to the gimp curves. Looks pretty close to me:
So finally, switch the x's to u's, and plug it into ImageMagick, and voila, my 6.9 output looks like my 6.7 output once again: