Note: all scripts examples included in these Web pages are absolutely free. You can copy, use, and modify these scripts anyway you want. The scripts are published without warranty of any kind.
View script result (shadow.jpg)
The script performs the following steps to create the target image:
| File shadow.vbs |
Set g = CreateObject("shotgraph.image")
' Dimensions of box
box_width = 320
box_height = 240
' Shadow offset
sh_offset = 15
' Shadow transparency (0-100)
sh_transparency = 25
' Path to source file
filename = "c:\winnt\web\wallpaper\paradise.jpg"
' Retrieving info about image size
g.GetFileDimensions filename,xsize,ysize
' Calculating the position of top left corner
' of the box on the bigger background image
boxx = (xsize-box_width)\2
boxy = (ysize-box_height)\2
' Creating primary imagespace and read image there
g.CreateImage xsize,ysize,16
g.ReadImage filename,pal,0,0
' Creating secondary imagespace...
g.InitClipboard box_width,box_height
' and making it active
g.SelectClipboard True
' Color #0 -- black color for shadow
g.SetColor 0,0,0,0
g.SetBgColor 0
' Filling secondary imagespace with color #0
g.FillRect 0,0,box_width,box_height
' Creating semi-transparent box
g.TransparentCopy boxx + sh_offset,boxy + sh_offset,box_width,box_height,0,0,0,sh_transparency
g.SelectClipboard False
' DRAWING BOX WITH TEXT
' Color #1 -- cyan color for box
g.SetColor 1,102,255,255
' Color #2 -- dark blue color for box border and text
g.SetColor 2,0,0,102
g.SetBgColor 1
g.SetDrawColor 2
g.Rectangle boxx,boxy,boxx+box_width-1,boxy+box_height-1
' Drawing text on text box
g.SetTextColor 2
g.SetBkMode "TRANSPARENT"
g.SetTextAlign "TA_CENTER","TA_BASELINE"
g.CreateFont "Verdana",0,45,200,True,False,False,False
g.TextOut xsize\2,ysize\2,"SHADOW"
g.JpegImage 95,0,"shadow.jpg"
|