Creating, Viewing, and Merging Color Separations (ASP - VBScript)
The following example creates CMYK color separations, saves each of the color planes in a multipage TIFF file, merges the planes, and displays the result. The code inverts the K plane to demonstrate how you can manipulate the color separations:
<%@ Language=VBScript %>
<%Option Explicit%>
<%
Dim RasterObj
Dim RasterIO
Dim RasterProc
Dim FILE_JFIF
Dim FILE_TIF
Dim COLORSEP_CMYK
Dim SAVE_OVERWRITE
Dim SAVE_APPEND
COLORSEP_CMYK = 1
SAVE_OVERWRITE = 0
SAVE_APPEND = 1
FILE_JFIF = 10
FILE_TIF = 3
Set RasterObj = Server.CreateObject("LEADRaster.LEADRaster")
Set RasterIO = Server.CreateObject("LEADRasterIO.LEADRasterIO")
Set RasterProc = Server.CreateObject("LEADRasterProcess.LEADRasterProcess")
RasterIO.Load RasterObj, "i:\a\pic\20020816demo3.jpg", 0, 0, 1
RasterProc.ColorSeparate RasterObj, COLORSEP_CMYK
'Just for fun, invert the K plane
RasterObj.Bitmap = RasterProc.ColorPlanes(3) 'Copy the K plane
RasterProc.Invert RasterObj 'Invert the K plane
RasterProc.ColorPlanes(3) = RasterObj.Bitmap 'Update the K plane
'Save the color planes into a multipage TIFF file
RasterObj.Bitmap = RasterProc.ColorPlanes(0) 'Cyan
RasterIO.Save RasterObj, "c:\Planes.tif", FILE_TIF, 24, 0, SAVE_OVERWRITE
RasterObj.Bitmap = RasterProc.ColorPlanes(1) 'Magenta
RasterIO.Save RasterObj, "c:\Planes.tif", FILE_TIF, 24, 0, SAVE_APPEND
RasterObj.Bitmap = RasterProc.ColorPlanes(2) 'Yellow
RasterIO.Save RasterObj, "c:\Planes.tif", FILE_TIF, 24, 0, SAVE_APPEND
RasterObj.Bitmap = RasterProc.ColorPlanes(3) 'K
RasterIO.Save RasterObj, "c:\Planes.tif", FILE_TIF, 24, 0, SAVE_APPEND
'Merge the color planes
RasterProc.ColorMerge RasterObj, COLORSEP_CMYK
RasterProc.ColorPlanes(0) = 0
RasterProc.ColorPlanes(1) = 0
RasterProc.ColorPlanes(2) = 0
RasterProc.ColorPlanes(3) = 0
RasterIO.Save RasterObj, "c:\asp.jpg", FILE_JFIF, 0, 2, 0
Response.Write "<IMG SRC='c:\asp.jpg'>"
%>