How can I check if image is transparent in image magic++?
i am using im 6.9.6
image.matte() returns true even for non transparent images.
Can someone please help?
Thanks
check if image is transparent
-
- Posts: 5
- Joined: 2018-06-28T15:02:22-07:00
- Authentication code: 1152
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: check if image is transparent
Use one of the properties that is equivalent to the command line string format %[opaque], which is shown at http://www.imagemagick.org/script/escape.php.
Sorry I do not use Magick++, so one of the other users or developers will need to help if you cannot figure that out.
Sorry I do not use Magick++, so one of the other users or developers will need to help if you cannot figure that out.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: check if image is transparent
I'm not sure what test you want:
1. Whether or not the image is fully opaque.
2. Whether or not the image is fully transparent.
3. Whether or not the image contains any transparency.
For (1), use %[opaque].
For (2), find the minimum opacity (alpha). If this is 100%, the image is fully transparent.
For (3), find the maximum opacity (alpha). If this is 100%, the image has no transparency.
1. Whether or not the image is fully opaque.
2. Whether or not the image is fully transparent.
3. Whether or not the image contains any transparency.
For (1), use %[opaque].
For (2), find the minimum opacity (alpha). If this is 100%, the image is fully transparent.
For (3), find the maximum opacity (alpha). If this is 100%, the image has no transparency.
snibgo's IM pages: im.snibgo.com