User's Guide

RGB2CMYK

Translates RGB input into CMYK output.

Function:

Translates three-band input images representing red, green, and blue values into images representing cyan, magenta, yellow, and/or black components in that order.

Parameters:

IN
Input image. The input image must be BYTE and must contain three image bands, containing the red, green, and blue components.

OUT
Output image. The output image is from one to four bands containing the cyan, yellow, magenta, and black components.

BANDOPT(CYAN,MAGENTA,YELLOW,BLACK)
Band option. Any combination of the bands specified are generated. The default is for the generation of all four bands.

  = CYAN:    Cyan band
  = MAGENTA: Magenta band
  = YELLOW:  Yellow band
  = BLACK:   Black band

ODTYPE(SAME)
Output data type. The data type of the output image.


  = SAME:  Same as input 
  = BYTE:  BYTE      (8-bit unsigned integer)
                     (0 through 255)
  = I*2:   INTEGER*2 (16-bit signed integer)
                     (-32768 through 32767)
  = I*4:   INTEGER*4 (32-bit signed integer)
                     (-2147483648 through 2147483647)
  = R*4:   REAL*4    (32-bit signed real)
                     (System dependent)

Example:

  1. LAS> rgb2cmyk in=rgbimg out=cmykimg bandopt=(cyan,magenta,yellow,black) odtype=i*2

    RGB2CMYK translates RGBIMG (containing the three bands of RGB components) into CMYKIMG (consisting of CMYK components). The data type of the output image is INTEGER*2.

Description/Algorithm:

A variety of techniques exist for displaying multi-spectral image data in color. One of these is displaying the red, green, and blue (RGB) components of an image. Another technique is to produce and display the complements of red, green and blue--namely cyan, magenta, and yellow (CMY). These are called subtractive primaries because their effect is to subtract some color from white light. The subspace of the cartesian coordinate system for CMY is the same as for RGB, except that white (full light) is at the origin instead of black (no light). Colors are specified by what is removed or subtracted from white light rather than by what is added to blackness.

The algorithms for generation of cyan, magenta, yellow, and black bands are as follows:

	CYAN(i,j)    = 255 - RED(i,j)
 	MAGENTA(i,j) = 255 - GREEN(i,j)
	YELLOW(i,j)  = 255 - BLUE(i,j)
	BLACK(i,j)   = MINIMUM (CYAN(i,j),MAGENTA(i,j),YELLOW(i,j))

where (i,j) is the pixel location with RED being the first band, GREEN being the second band, and BLUE being the third band.

The algorithm used in the program was modeled after one presented in Fundamentals of Interactive Computer Graphics by J. D. Foley and A. VanDam.

     Reference:

     J. D. Foley and A. VanDam, Fundamentals of Interactive 
     Computer Graphics, Addison-Wesley Publishing Company, 
     Reading, Massachusetts, 1982, Chap. 17, Section 17.4.2,
     "The HLS Color Model," p. 612.

Nonfatal Error Messages:

  1. [rgb2cmyk-close] Error closing images

    An error occurred in closing the image files.

  2. [rgb2cmyk-minmax] Error updating the minmax information

    An error occurred while updating the minimum and/or maximum information within the DDR file.

  3. [rgb2cmyk-history] Error accessing the history information

    An error occurred in updating the DDR file with the correct history information. The image data is saved.

Fatal Error Messages:

  1. [rgb2cmyk-band] Input image does not have exactly three bands

    The name specified in parameter "IN" must contain three bands to correspond to the red, green, and blue bands expected by the program.

  2. [rgb2cmyk-type] Input image is not BYTE data type

    The input image must be of BYTE data type only in order for the algorithm to work correctly.

  3. [rgb2cmyk-window] Images do not have the same window sizes

    The number of lines or samples for the specified images are different for the corresponding IN elements.

  4. [rgb2cmyk-open] Error opening input image

    An error occurred in opening the input files.

  5. [rgb2cmyk-open] Error opening output image

    An error occurred in opening the output files.

  6. [rgb2cmyk-alloc] Error allocating dynamic memory

    An error occurred while allocating dynamic memory for processing.

  7. [rgb2cmyk-fatal] Fatal error encountered

    A fatal error was encountered during processing. The output image file is not deleted, and processing is terminated. The message that is displayed immediately preceding this error message is the specific error that was encountered.

User Note:

    None.