←Select platform

TileHeight Property

Summary
Gets or sets the height of the tile to use when saving TIFF files.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public int TileHeight { get; set; } 
@property (nonatomic, assign) NSUInteger tileHeight; 
public int getTileHeight() 
public void setTileHeight(int value) 
public: 
property int TileHeight { 
   int get(); 
   void set (    int ); 
} 
TileHeight # get and set (CodecsTiffSaveOptions) 

Property Value

The default value is 0

The height of the tile to use when saving TIFF files.

Remarks

When saving TIFF files, the size of the tiles or strips saved in the file can be controlled. Some graphic packages cannot load TIFF files unless the files are saved with a certain tile or strip size. LEADTOOLS can load files of any strip and tile size, so modifying these settings is not necessary when saving files that will be loaded with LEADTOOLS.

If the UseTileSize Property is not true, then TileWidth and TileHeight are ignored. In this case, the image will be saved like in the previous versions of LEADTOOLS.

If TileWidth is less than or equal to the image width, the image will be saved as tiles. If TileWidth is greater than the image width, the image will be saved as strips. If the image is saved as tiles, TileHeight controls the height of the tile. If the image is saved as strips, TileHeight controls the height of the strip. The image can be saved as one strip by setting TileHeight to a value greater than the image height.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
 
using Leadtools.ImageProcessing.Core; 
 
public void CodecsTiffOptionsExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "OCR1.TIF"); 
 
   // Get all Information about the Tiff file that you want to load. 
   CodecsImageInfo imageInfo = codecs.GetInformation(srcFileName, true); 
 
   if (imageInfo.Tiff.IsImageFileDirectoryOffsetValid) 
   { 
      codecs.Options.Tiff.Load.ImageFileDirectoryOffset = imageInfo.Tiff.ImageFileDirectoryOffset; 
      codecs.Options.Tiff.Save.ImageFileDirectoryOffset = imageInfo.Tiff.ImageFileDirectoryOffset; 
   } 
 
   // CodecsTiffOptions & CodecsTiffLoadOptions reference 
   codecs.Options.Tiff.Load.UseImageFileDirectoryOffset = imageInfo.Tiff.IsImageFileDirectoryOffsetValid; 
   codecs.Options.Tiff.Save.UseImageFileDirectoryOffset = imageInfo.Tiff.IsImageFileDirectoryOffsetValid; 
 
   codecs.Options.Tiff.Load.IgnorePhotometricInterpretation = true; 
   codecs.Options.Tiff.Load.IgnoreViewPerspective = false; 
   codecs.Options.Tiff.Load.UseFastConversion = false; 
 
   RasterImage image = codecs.Load(srcFileName); 
 
   codecs.Options.Tiff.Save.NoPalette = imageInfo.Tiff.HasNoPalette; 
   codecs.Options.Tiff.Save.PreservePalette = imageInfo.Tiff.HasNoPalette; 
 
   // Set the tiffSave options 
   // CodecsTiffSaveOptions reference 
   codecs.Options.Tiff.Save.NoPageNumber = false; 
   codecs.Options.Tiff.Save.NoSubFileType = false; 
   codecs.Options.Tiff.Save.UsePhotometricInterpretation = true; 
   codecs.Options.Tiff.Save.PhotometricInterpretation = CodecsTiffPhotometricInterpretation.YcbCr; 
   codecs.Options.Tiff.Save.UseTileSize = true; 
   codecs.Options.Tiff.Save.TileHeight = 200; 
   codecs.Options.Tiff.Save.TileWidth = 200; 
   codecs.Options.Tiff.Save.NoLzwAutoClear = false; 
   codecs.Options.Tiff.Save.SavePlanar = false; 
   codecs.Options.Tiff.Save.UsePredictor = false; 
 
   // make the output file have the same format as the input, so Tiff->Tiff, BigTiff->BigTiff 
   codecs.Options.Tiff.Save.BigTiff = imageInfo.Tiff.IsBigTiff; 
 
   //saving the image 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "testtiff1.TIF"), RasterImageFormat.Tif, image.BitsPerPixel, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite); 
 
   //change some tiffsave options. 
   codecs.Options.Tiff.Save.NoPageNumber = true; 
   codecs.Options.Tiff.Save.NoSubFileType = true; 
   codecs.Options.Tiff.Save.UsePhotometricInterpretation = false; 
   codecs.Options.Tiff.Save.UseTileSize = false; 
   codecs.Options.Tiff.Save.NoPalette = false; 
   codecs.Options.Tiff.Save.PreservePalette = true; 
   codecs.Options.Tiff.Save.PhotometricInterpretation = CodecsTiffPhotometricInterpretation.Palette; 
 
   //save the image with different name. 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "testtiff2.TIF"), RasterImageFormat.CcittGroup4, image.BitsPerPixel, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite); 
 
   // Clean up 
   image.Dispose(); 
   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.