How can I check if an Image has an alpha channel?
"What have you tried?"
AlphaChannelandColorSeparate[..., "A"]return a result even if the image had no explicit alpha channel.We could check the number of results from
ColorSeparateorImageChannels, but that also depends onColorSpace, which may also be aColorProfileDataobject (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