Thanks!
I get it now. My understanding was that -opaque white was "marking" white image pixels as opaque in the alpha channel. Now my understanding is that it's "converting" white pixels to opaque, leaving behind ... nothing, which is why you need a -fill. To make it work as I thought, you just -fill white, that is, the same colour that you converted to opaque.
Code: Select all
magick -size 10x10 canvas:white -fill white -opaque white PNG32:out1.png
magick -size 10x10 canvas:white -opaque white PNG32:out1.png
magick out1.png -channel a -separate alpha1.png
magick out2.png -channel a -separate alpha2.png
out1 is opaque white
out2 is transparent (invisible colour is black, possibly)
alpha1 is white, showing that opaque is encoded as alpha=255
alpha2 is black, showing that alpha=0 means transparent
which is what I expected.