LEADTOOLS Raster Imaging C++ Class Library Help > LEADTOOLS Raster Imaging Features > Processing an Image > Handling CMYK Files as Separate Bitmaps |
LEADTOOLS supports loading TIFF CMYK files without converting the data to BGR. This is done by loading each CMYK plane as a separate LEADTOOLS bitmap using LFile::LoadCMYKArray. Alpha channel information can be loaded or ignored as follows:
to ignore alpha information, create an array of 4 BITMAPHANDLE structures.
or :
to load alpha information, create an array of 5 BITMAPHANDLE structures. (The alpha channel will be stored in the 5th element of the array).
If the source file is not in the TIFF CMYK format, load the bitmap normally with LFile::Load, LMemoryFile::Load, LFile::LoadResize, LFile::LoadFile, LFile::LoadOffset, LMemoryFile::LoadMemory or LMemoryFile::LoadMemoryTile and then obtain the CMYK planes by calling LBitmap::ColorSeparate.
Paint the bitmaps using LPaint::PaintDCCMYKArray.
To save the bitmap as TIFF CMYK, call LFile::SaveCMYKArray. To save as another format, create a BGR bitmap using LBitmap::ColorMerge and then save the image with LFile::Save or LFile::SaveFile.
The bitmap can be manipulated by manipulating each plane independently. Be careful when doing this. Some transformations should be done to all of the planes, while others should be done only to a particular plane.
For example, when performing a spatial transformation (flip, resize, rotate, etc), perform the same spatial transformation on all of the planes. Otherwise, there may be unwanted or unexpected results.
Other transformations should be done to a particular plane. For example, the K plane controls the amount of black ink. Changing the intensity of the K plane will darken or lighten the bitmap. Changing the brightness of one of the other planes will change the color rather than the image brightness. Be sure to study how the CMYK planes are combined to make the final image, in order to have a good understanding of what is needed to achieve a particular result.