Assigns a soft mask to the image.




Image.SetMask Mask, Invert



Name Type Description
Mask XImage The image containing the soft mask.
Invert Boolean Whether to invert the mask.




Assigns a soft mask or alpha channel. Soft masks are used to assign levels of transparency to an image.

The mask provided will be converted to a grayscale intensity map and may be scaled to ensure that the dimensions of the mask match those of the image. The assigned mask applies to all frames of the current image.

If the Invert parameter is set, then the mask will be inverted - making transparent areas opaque and opaque areas transparent.

Different images within the mask can be accessed using the Frame property. Different portions of the mask can be selected using the Selection property.

Note that transparency is only applied to an Image if the Indirect property is true (which is generally the case).




Here, we read a TIFF file and present the data to the Image object. We then read a mask image and assign that to our Image. Finally, we add the image to our document and then save the PDF.

Set theDoc = Server.CreateObject("ABCpdf10.Doc")
Set theImg = Server.CreateObject("ABCpdf10.Image")
Set theMsk = Server.CreateObject("ABCpdf10.Image")
theImg.SetFile "c:\mypics\mypic.tif"
theMsk.SetFile "c:\mypics\mymask.jpg"
theImg.SetMask theMsk, True
theDoc.Color = "0 0 0"
theDoc.Rect.Inset 20, 20
theDoc.AddImageObject theImg, True
theDoc.Save "c:\mypdfs\imagesetmask.pdf"

Given the following input images.



This is the kind of output you might expect.