CMYKRaster Example for Visual Basic
This example will load an array of CMYK TIFF files, increase the brightness of the K plane only (which will darken the image) and save the file as CMYK TIFF
Public RasterIO As New LEADRasterIO
Public Raster As New LEADRaster
Public RasterPorc As New LEADRasterProcess
Public RasterView As LEADRasterView
Private Sub TestLoadCMYKArray()
Dim nRet As Integer
nRet = RasterIO.GetFileInfo(Raster, "cmyk.tif", 0, 0)
If nRet <> 0 Then
MsgBox "Invalid source file"
Exit Sub
End If
RasterIO.CMYKRasterCount = 4
nRet = RasterIO.LoadFileCMYKArray("cmyk.tif", 8, 1)
If nRet <> 0 Then
MsgBox "LoadFileCMYKArray failed!"
Exit Sub
End If
' The load has succeeded.
' Increase the brightness of the K (black) plane by 50%
' Note that this will DARKEN the image, because we increased the amount of black!
nRet = RasterPorc.Intensity(RasterIO.CMYKRaster(3), 500)
If nRet <> 0 Then
MsgBox "Intensity failed!"
Else
nRet = RasterIO.SaveFileCMYKArray("c:\\myCMYK.tif", FILE_TIFLZW_CMYK, 8, 2, 0,False)
If nRet <> 0 Then
MsgBox "SaveFileCMYKArray failed!"
End If
End If
RasterView.RasterIO = RasterIO
RasterView.EnablePaintCMYKArray = True
End Sub