How to know if image is fully opaque
Posted: 2017-02-21T17:16:57-07:00
Hello everyone.
I used to list images with a batch file specifying %[type] and %[opaque] (returns true if all pixels are fully opaque, false otherwise) in -format. If image was TrueColorAlpha and opacity was true, then the alpha channel was empty (fully opaque image) and could be discarded.
I want to achieve the same through MagickWand, but other than MagickGetImageAlphaChannel to know if image has an alpha channel, I'm lost. I don't seem to find any equivalent function of %[opaque]. Is there any function I can use? Or do I have to iterate each pixel and check its opacity? In that case, is it possible to iterate somehow through the alpha channel's values directly?
Regards, JMM
I used to list images with a batch file specifying %[type] and %[opaque] (returns true if all pixels are fully opaque, false otherwise) in -format. If image was TrueColorAlpha and opacity was true, then the alpha channel was empty (fully opaque image) and could be discarded.
I want to achieve the same through MagickWand, but other than MagickGetImageAlphaChannel to know if image has an alpha channel, I'm lost. I don't seem to find any equivalent function of %[opaque]. Is there any function I can use? Or do I have to iterate each pixel and check its opacity? In that case, is it possible to iterate somehow through the alpha channel's values directly?
Regards, JMM