Creating, Viewing, and Merging Color Separations (ASP - JavaScript)
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=JavaScript %>
<%
var COLORSEP_CMYK = 1;
var SAVE_OVERWRITE = 0;
var SAVE_APPEND = 1;
var FILE_JFIF = 10;
var FILE_TIF = 3;
var RasterObj = Server.CreateObject("LEADRaster.LEADRaster");
var RasterIO = Server.CreateObject("LEADRasterIO.LEADRasterIO");
var 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.SaSaMethodve(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'>");
%>