Notifications
Clear all

[Closed] How <bitmap>.hasAlpha works?

Hi!
I want is to check whether a map has an alpha channel or not.
I found this in maxscript reference:
[left]
[/left]

[left]<bitmap>.hasAlpha :  Boolean, read-only
[/left]
 [left]This property  contains true if the bitmap has an alpha channel and false if it does not. 
[/left]

[left]

[/left]
[left]This is the code that I use:
[/left]
[left]


[/left]
[left]	bm1 = bitmap 256 256 filename:"C:\Alpha.tga"
	bm2 = bitmap 256 256 filename:"C:\No_Alpha.tga"	
	
	print bm1.hasAlpha
	--	true
	print bm2.hasAlpha
	--	true

[/left]
[left]

[/left]
[left]hasAlpha returns true for both maps. Why?
[/left]
[left]

[/left]
[left]The maps are in attachment.

[/left]

2 Replies
bm1 bitmap 256 256 filename:"C:\Alpha.tga"

means that you are creating a new bitmap which would be saved to the file: C:\Alpha.tga IF you wrote:

save bm1

what you need to do is open the bitmap using the openBitmap function like so:

bm1 = openBitmap "C:\Alpha.tga"

then the hasAlpha property will work as expected

Thak you, Gravey! Everything works now.