←Select platform

SaveCmykPlanes(RasterImage,string,RasterImageFormat,int,int,CodecsSavePageMode) Method

Summary
Saves the pages of an image as a CMYK TIFF or JPEG file.
Syntax
C#
Objective-C
C++/CLI
Python
- (BOOL)saveCmykPlanes:(LTRasterImage *)image  
                  file:(NSString *)file  
                format:(LTRasterImageFormat)format  
          bitsPerPlane:(NSInteger)bitsPerPlane  
            pageNumber:(NSInteger)pageNumber  
              pageMode:(LTCodecsSavePageMode)pageMode  
                 error:(NSError **)error 

Parameters

image
The image that contains the CMKY planes to be saved.

fileName
A String containing the name of the image file to save.

format
Specifies the output file format. Valid values are:

bitsPerPlane
Resulting bits per pixel for each plane. Possible values:

Value Meaning
0 Default bits per pixel. LEADTOOLS will pick the closest valid value.
8 Save 8 bits per component. The generated file will contain 32 bits (no alpha) or 40 bits (if alpha). Note that GetInformation or GetInformationAsyncwill report 8 bits less (24 or 32-bit).
16 Save 16 bits per component. The generated file will contain 64 bits (no alpha) or 80 bits (if alpha). Note that GetInformation or GetInformationAsyncwill report 16 bits less (48 or 64-bit). This is not available for saving JPEG CMYK files.

pageNumber
Specifies the reference page number when saving a multipage file.

pageMode
Determines how to handle the page when saving to multipage formats.

Remarks

This method will save a CMYK file without performing a color conversion. Each page in the  image will contain one of the C, M, Y, K, Alpha planes. The Alpha plane is optional. The  image should contain:

  • 4 pages if you do not save alpha channel information or
  • 5 pages if you save alpha channel information

The pages are in this order: C, M, Y, K, Alpha (optional). All the pages must have the same width, height, bits per pixel and palette.

If you want to save the pages of the  image as a file format not supported by this function, use ColorMergeCommand to create a BGR image and save the generated image using the Save method.

CMYK TIFF files can be saved as planar (each image in its own plane) or chunky (the data from all the images will be interleaved during saving). Planar images will be saved faster, while chunky images are more compatible (some TIFF readers will not read planar files) and require less memory during the load process. The default is to save chunky files.

You select the planar save mode by setting the RasterCodecs.Options.Tiff.Save.SavePlanar property to true.

This method uses the values of RasterCodecs.Options.Tiff.Save.ImageFileDirectoryOffset.

This method can also be used to copy or extract one or more pages from a TIFF file and copy them without recompression to another TIFF file. Whenever you save an image containing a region as a TIFF file format, the region is also saved. Note, however, that the ability to save a region inside a TIFF file must be unlocked. This requires a Document Imaging or Document Imaging toolkit.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
void CmykPlanesExample(string cmykTifFile) 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "CmykPlanesTif.tif"); 
 
   // Load the CMYK Planes of this image 
   RasterImage cmykImage = codecs.LoadCmykPlanes(cmykTifFile, 8, 1); 
 
   Debug.WriteLine("CMYK planes loaded into an image with {0} pages", cmykImage.PageCount); 
   Debug.Assert(cmykImage.PageCount == 4); 
 
   // 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! 
 
   Debug.WriteLine("Changing the intensity of the K plane (the 4th page)"); 
   ChangeIntensityCommand command = new ChangeIntensityCommand(); 
   command.Brightness = 500; 
   cmykImage.Page = 4; 
   command.Run(cmykImage); 
   cmykImage.Page = 1; 
 
   Debug.WriteLine("Saving the image to the destination file"); 
   codecs.SaveCmykPlanes(cmykImage, destFileName, RasterImageFormat.TifLzwCmyk, 8, 1, CodecsSavePageMode.Overwrite); 
   cmykImage.Dispose(); 
 
   // Clean up 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools.Codecs Assembly

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