PDA

View Full Version : BaseClip Translucency


sundaysky
6th September 2007, 13:38
Hey guys,

I'm trying to create a script which animates the following function:

function smartCrop (clip clip, int x, int y, int w, int h, int xo, int yo)
{ black=ImageReader("c:\media\pics\black.png",0,100,pixel_type="RGB32").BilinearResize(720,576)
c=Crop(clip,x,y,w,h)
Overlay(black,c,xo,yo)
}

Black.png is completely transparent. I'm using the background becuase i must keep the same frame size, and i don't want to resize the video after cropping (doing crop&resize by using BilinearResize(6) for example). I intend to overlay the result on some other media in the future, so the transparency is important

When I use overlay, the background wouldn't be rendered transparent, but completely opaque. I've tried playing around with Layer, but still couldn't get to the point where only the overlay_clip is visible and the base_clip is invisible/transparent.

Help? Pretty please?

:eek:

IanB
6th September 2007, 15:31
function smartCrop (clip clip, int x, int y, int w, int h, int xo, int yo) {
black=ImageReader("c:\media\pics\black.png",0,100,pixel_type="RGB32").BilinearResize(720, 576)
# Return ShowAlpha(Black)
c=Clip.ConvertToRGB32().Crop(x, y, w, h).ResetMask()
Layer(black, c, "Add", 257, xo, yo)
}The output image will be opaque where clip is and the original transparancy of black.png everywhere else.

Use the ShowAlpha line to check that the .PNG imports correctly, the DevIL library it uses can be recalcitrant. If you simply want a Transparent Black clip use BlankClip(100, 720, 576, pixel_type="RGB32", color=$aarrggbb), where color is a Hexadecimal number spec'ing Alpha, Red, Green, Blue in pairs. aa=00 is transparent, aa=FF is opaque.