can I check if an image is transparent??

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: can I check if an image is transparent??

Post by anthony »

Sorry for the slow delay.

Code: Select all

identify -verbose image
Look for statistics, alpha, and if the maximin is not zero there is at least some semi-transparency.

Alternative extract the alpha channel...

Code: Select all

convert image -matte -channel A -separate -format '%[fx:image.maxima]' info: 
If 0 it is fully-opaque, it is 1, image has full transparent,
a value between only some semi-transparency (translucent)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply