Log in

View Full Version : Resizing image looses alpha channel


exyll
11th March 2008, 20:48
I'm performing the following action:

The video is a 640x480 source and the logo is a high res logo.

vid = AviSource("test.avi")
vid = LanczosResize(vid, 400, 300, 0.6)

logo = ImageSource("logo.png", pixel_type="RGB32")
logo = BicubicResize(logo, 50, 50)

vid = Overlay(vid, logo, mode="blend", opacity=1, x=345,y=5)

return vid

Resizing works for both the video and the logo but the logo now lost its transparancy mask/alpha channel and shows up like a block.

Is this a bug or am I resizing the logo incorrectly?

IanB
11th March 2008, 21:53
No, you are using Overlay incorrectly.

Overlay() does not use the Alpha channel from RGB32 clips. You need to extract the Alpha information with ShowAlpha() and provide it as a separate mask clip to Overlay().vid = Overlay(vid, logo, mask=ShowAlpha(Logo), mode="blend", opacity=1, x=345,y=5)

The older Layer() function does use the Alpha channel directly but all clips must be RGB32 format.

exyll
12th March 2008, 22:11
Thanks it now works!