How can I check if an Image
has an alpha channel?
"What have you tried?"
AlphaChannel
andColorSeparate[..., "A"]
return a result even if the image had no explicit alpha channel.We could check the number of results from
ColorSeparate
orImageChannels
, but that also depends onColorSpace
, which may also be aColorProfileData
object (for which it isn't clear how to determine the number of expected channels).
Answer
I just discovered this command (in the Properties and Relations sections of the AlphaChannel
command)
ImageMeasurements[img, "Transparency"]
It returns True
if there is an alpha channel and False
otherwise.
Comments
Post a Comment