Inserts one canvas into a color or alpha channel on another.

 

   
Syntax
 
     

[VBScript]
Canvas.SetChannel inChannel, inImage

 

   
Params
 
     
Name   Type   Description
inChannel String The name of the channel.
inImage String The Image from the Canvas to use as an intensity map.

 

   
Notes
 
     

This allows you to insert a color channel using another Canvas as an intensity map. Most commonly you will want to use this method to insert an alpha channel using another Canvas as a matte. You can use then use blends and transparencies (both are specified using alpha channels).

The depth of the Canvas will be set to 'millions' as soon as you insert a channel. If the sizes of the two Canvases do not match the intensity map Canvas will be stretched to the correct size.

The channel names you can use are:

  • "red"
  • "green"
  • "blue"
  • "alpha"

 

   
See Also
 
     

Canvas Image property.
Canvas DrawCanvas function.
Mode
parameter.
Alpha Channels
.

 

   
Example
 
     

[VBScript]
Set bg = Server.CreateObject("ImageGlue7.Canvas")
Set stamp = Server.CreateObject("ImageGlue7.Canvas")
Set mask = Server.CreateObject("ImageGlue7.Canvas")
' create canvas
bg.Color = "blue"
bg.Width = 100
bg.Height = 90
mask.DrawFile Server.MapPath("cloud.gif"), ""
stamp.Width = mask.Width
stamp.Height = mask.Height
' first draw white cloud
stamp.Color = "white"
stamp.Erase
stamp.SetChannel "alpha", mask.Image
bg.DrawCanvas stamp.Image, "Pos=10,10 Mode=Transparent"
' ... then light gray cloud
stamp.Color = "lightgray"
stamp.Erase
stamp.SetChannel "alpha", mask.Image
bg.DrawCanvas stamp.Image, "Pos=60,10 Mode=Transparent"
' ... then dark gray cloud
stamp.Color = "darkgray"
stamp.Erase
stamp.SetChannel "alpha", mask.Image
bg.DrawCanvas stamp.Image, "Pos=10,60 Mode=Transparent"
' ... then black cloud
stamp.Color = "black"
stamp.Erase
stamp.SetChannel "alpha", mask.Image
bg.DrawCanvas stamp.Image, "Pos=60,60 Mode=Transparent"
' finally save image
bg.SaveAs Server.MapPath("setchannel.jpg"), "Quality=high"

The above draws four solid blocks of color using an alpha channel as a matte. The input and output files are shown below.

cloud.gif

setchannel.jpg