View Full Version : MEL: How to check if an image has an alpha channel

03 March 2007, 12:52 PM
Hi people
Does anyone know of a command or a way to query if an image file has an alpha channel or not?

what i want to do is something like:
if (/*THE FILE HAS AN ALPHA CHANNEL*/) connectAttr -f ($fileNode + ".outTransparency") ($lambert + ".transparency");
else //dont do anything
Any ideas?

03 March 2007, 11:04 AM
Most efficient way to get that info is:

getAttr IMAGE.fileHasAlpha;

where IMAGE should be replaced with the name of your object/image that should be already loaded as texture.
If return value is 1 there is alpha, if it is 0 there is no alpha.

Hope this helps!

CGTalk Moderation
03 March 2007, 11:04 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.