Color Space Transform

This sample source code illustrates the use of the transformation between different image color spaces. The sample code is based on Microsoft Visual Basic. The Ilixis Developer's Corner does not warrant that the sample source code. This sample source code is for guidance and illustration purposes only.



' CMY values used are between 0 and 1
' All variables used are of data type DOUBLE


CMY to CMYK

Tmp = 1

If ( C < Tmp ) Then
    Tmp = C
End If
If ( M < Tmp ) Then
    Tmp = M
End If
If ( Y < Tmp ) Then
    Tmp = Y
End If

C = ( C - Tmp ) / ( 1 - Tmp )
M = ( M - Tmp ) / ( 1 - Tmp )
Y = ( Y - Tmp ) / ( 1 - Tmp )
K = Tmp 


CMYK to CMY

C = ( C * ( 1 - K ) + K )
M = ( M * ( 1 - K ) + K )
Y = ( Y * ( 1 - K ) + K )




 


  Developer's Corner
 
Introduction
Imaging Toolkits
TWAIN
Image Formats
Color Spaces
Auto Recognition
Useful Links
Transform Logic
RGB <-> CMY
CMY <-> CMYK
RGB <-> HSL
Learn More...
Concepts