Creating, Viewing, and Merging Color Separations (Visual Basic Script)
Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations:
1. |
Start with the project that you created in Loading and Displaying an Image. |
2. |
Add the following code between the <BODY> </BODY> tags to add a LEAD Raster Process object named RasterProc: |
<OBJECT ID="RasterProc" NAME="RasterProc"
CLASSID="CLSID:00140712-B1BA-11CE-ABC6-F5B2E79D9E3F"
CODEBASE="path to CAB file/Ltrpr14n.cab">
<P>This is not supported in the web browser.</P>
</OBJECT><BR>
3. |
Add the following code between the <FORM> </FORM> tags to add the button btnColorSeparate: |
<INPUT TYPE="button" NAME="btnColorSeparate" VALUE="Color Separate" LANGUAGE="VBScript"
OnClick="ColorSeparate">
4. |
Add the following code between the <SCRIPT> </SCRIPT> tags: |
Dim ClickCount
5. |
Add the following code between the <SCRIPT> </SCRIPT> tags for btnColorSeparate button: |
Sub ColorSeparate()
Dim msg
Dim COLORSEP_CMYK
COLORSEP_CMYK = 1
'Turn off the automatic display rectangles.
LEADRasterView1.AutoSetRects = False
LEADRasterView1.Raster.RefBitmap = False
Select Case ClickCount
Case 0
RasterProc.ColorSeparate LeadRasterView1.Raster, COLORSEP_CMYK
'Just for fun, add contrast to the K plane
LEADRasterView1.Raster.Bitmap = RasterProc.ColorPlanes(3) 'Copy the K plane
RasterProc.Contrast LeadRasterView1.Raster, 300 'Increase the contrast
RasterProc.ColorPlanes(3) = LEADRasterView1.Raster.Bitmap 'Update the K plane
msg = "Separated. Keep clicking to see separations, then merge"
MsgBox msg
Case 1
LEADRasterView1.Raster.Bitmap = RasterProc.ColorPlanes(0) 'Cyan
LEADRasterView1.ForceRepaint
Case 2
LEADRasterView1.Raster.Bitmap = RasterProc.ColorPlanes(1) ' Magenta
LEADRasterView1.ForceRepaint
Case 3
LEADRasterView1.Raster.Bitmap = RasterProc.ColorPlanes(2) ' Yellow
LEADRasterView1.ForceRepaint
Case 4
LEADRasterView1.Raster.Bitmap = RasterProc.ColorPlanes(3) ' K
LEADRasterView1.ForceRepaint
Case 5
RasterProc.ColorMerge LeadRasterView1.Raster, COLORSEP_CMYK
LEADRasterView1.ForceRepaint
RasterProc.ColorPlanes(0) = 0
RasterProc.ColorPlanes(1) = 0
RasterProc.ColorPlanes(2) = 0
RasterProc.ColorPlanes(3) = 0
msg = "Merged, with more contrast in the K plane"
MsgBox msg
Case Else
ClickCount = -1
msg = "Cycle is finished"
MsgBox msg
End Select
ClickCount = ClickCount + 1
End Sub
6. |
Run your page to test it. |