PDA

View Full Version : DropShadows


MrLabRat
25th July 2008, 00:50
I'm using DVD GUI to write .AVS files.
I am trying to tweak it once I have the .AVS exported.
One thing I am trying to do is apply a nice looking DropShadow to my moving images. If you know a way please post it.

########## Below is my crappy example of what I am trying to do in an .AVS file.

YOU MIGHT WANT TO COPY AND PASTE INTO AN EDITOR. IT has comments as to what I am thinking.

#### BEGIN CODE #####
# Variables
img = ImageSource("C:\MyImage") # Image
msk = ImageSource("C:\MyMask") # Mask

# My function being called.
img = ImgDrpShdw(img, msk)
# The guts of this function are shown below.


# of course there is a ton of code missing, and if you are familiar with DVD GUI you are familiar with the generic "img" variable
#img gets returned inside of the KenBurns zoom function, there is also a moving background that I am leaving out of this example.

# this is the function i wrote in an attempt to apply a Drop shadow to my Animated Image.


function ImgDrpShdw (clip a, clip b)
{
# clip a is intended to be main image.
#clip b is intended to be mask.
# Width and Height set to Main Image - Main Image changes it's dimensions throughout the slideshow
W = width(a)
H = height(a)
# has to be converted to RGB32 or it won't work
a = a.ConvertToRGB32()
# mask changed to fit Main clip.
b = b.BilinearResize(W, H).ConvertToRGB32()
# my attempt at a transparent BG
transBG = blankclip(width=W, height=H, color=$000000)
# This removes the color black, and of course the blankclip is black.
transBG = resetmask(transBG).colorkeymask($000000, 128)
#Overlay Image with mask and transBG
msk = overlay(transBG, a, mask=b, mode="blend")
return msk
}


##### END CODE #####


That is it... i have been doing this for two whole days... nothing seems to work. So i broke down and decided to post on this forum. If you can help I would appreciate it.

Gavino
25th July 2008, 22:34
It's not clear from your post what form your mask image takes.
Assuming that it's actually an alpha channel transparency mask, then you need to change these lines

msk = ImageSource("C:\MyMask")
...
b = b.BilinearResize(W, H).ConvertToRGB32()
...
msk = overlay(transBG, a, mask=b, mode="blend")
to these:

msk = ImageSource("C:\MyMask", pixel_type="RGB32")
...
b = b.BilinearResize(W, H)
...
msk = overlay(transBG, a, mask=b.ShowAlpha, mode="blend")

This is because:
- ImageSource defaults to RGB24
- Overlay does not use the alpha channel explicitly, you have to use ShowAlpha