Conversion Given an ICM Profile (Visual Basic)

  1. Define the following global variables:

    Dim ClrHandle As Long 
    Dim cnvParam As CONVERSION_PARAMS 
    Dim wtPoint As WHITEPOINT 'this needs to be defined in VB, because its member in CONVERSION_PARAMS can't be accessed since it is a pointer and not a structure 
    Dim RGBColor(3) As Byte 
    Dim ColorSpace(4) As Byte 

  2. Set the conversion options by filling a CONVERSION_PARAMS structure:

    wtPoint.nWhitePoint = CIELAB_D50 
    wtPoint.xWhite = 0 
    wtPoint.yWhite = 0 
    cnvParam.uStructSize = Len(cnvParam) 
    cnvParam.nQuantization = 8 
    cnvParam.nMethod = USE_CUSTOM_ICC 
    cnvParam.nActiveMethod = USE_CUSTOM_ICC 
    cnvParam.pCmykParams = 0 
    cnvParam.pLabParams = 0 
    cnvParam.pYuvParams = 0 
    cnvParam.sDstInputTable(0) = 0 
    cnvParam.pWpoint = VarPtr(wtPoint) 
    cnvParam.pMemInputProfile = 0 
    cnvParam.pMemOutputProfile = 0 
    Dim str1 As String 
    str1 = "C:\\MyRGBProfile.ICM" 
    Dim i As Integer 
    For i = 0 To Len(str1) - 1 
       cnvParam.sInputProfile(i) = Asc(Right(str1, Len(str1) - i)) 
    Next i 
    str1 = "C:\\MyRGBProfile.ICM" 
    For i = 0 To Len(str1) - 1 
       cnvParam.sOutputProfile(i) = Asc(Right(str1, Len(str1) - i)) 
    Next i 

  3. Initialize the color conversion handle with L_ClrInit():

    L_ClrInit ClrHandle, CCS_CMYK, CCS_RGB, cnvParam 

  4. Now, do the conversion:

    ColorSpace(0) = 100 
    ColorSpace(1) = 100 
    ColorSpace(2) = 100 
    ColorSpace(3) = 100 
    L_ClrConvert ClrHandle, ColorSpace(0), RGBColor(0), 1, 1, 0, 0 

  5. At the end, free the color conversion handle:

    L_ClrFree ClrHandle 

See Also

Introduction
Bitmap Conversion Options
Color Conversion C API Function Groups
Getting Started

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Color Conversion C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.