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
How to know if image is fully opaque
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to know if image is fully opaque
In attribute.c, function IsOpaqueImage(). This works by testing every pixel for being opaque, because there is no other way of doing it.
snibgo's IM pages: im.snibgo.com
Re: How to know if image is fully opaque
I'm doing it with PascalMagick, so I'm limited to whatever is translated from the headers of MagickWand interface. I guess I'm having to do it myself with iterating through pixels. I guess it'll be about the same speed, I just wanted an easy way through an already made function. Thanks.