Leadtools.Codecs Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.17
CodecsTiffOptions Class
See Also  Members   Example 
Leadtools.Codecs Namespace : CodecsTiffOptions Class




Provides extra options for loading and saving TIFF images.

Object Model



Syntax

Visual Basic (Declaration) 
Public Class CodecsTiffOptions 
Visual Basic (Usage)Copy Code
Dim instance As CodecsTiffOptions
C# 
public class CodecsTiffOptions 
Managed Extensions for C++ 
public __gc class CodecsTiffOptions 
C++/CLI 
public ref class CodecsTiffOptions 

Example

Visual BasicCopy Code
CodecsTiffOptions
      Public Sub CodecsTiffOptionsExample()
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()

         Dim srcFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\OCR1.TIF"

         ' Get all Information about the Tiff file that you want to load.
         Dim imageInfo As CodecsImageInfo = codecs.GetInformation(srcFileName, True)

         If imageInfo.Tiff.IsImageFileDirectoryOffsetValid Then
            codecs.Options.Tiff.Load.ImageFileDirectoryOffset = imageInfo.Tiff.ImageFileDirectoryOffset
            codecs.Options.Tiff.Save.ImageFileDirectoryOffset = imageInfo.Tiff.ImageFileDirectoryOffset
         End If

         codecs.Options.Tiff.Load.UseImageFileDirectoryOffset = imageInfo.Tiff.IsImageFileDirectoryOffsetValid
         codecs.Options.Tiff.Save.UseImageFileDirectoryOffset = imageInfo.Tiff.IsImageFileDirectoryOffsetValid

         codecs.Options.Tiff.Load.IgnorePhotometricInterpretation = True

         Dim image As RasterImage = codecs.Load(srcFileName)

         codecs.Options.Tiff.Save.NoPalette = imageInfo.Tiff.HasNoPalette
         codecs.Options.Tiff.Save.PreservePalette = imageInfo.Tiff.HasNoPalette

         'Set the tiffSave options
         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

         'saving the image
         codecs.Save(image, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\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, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\testtiff2.TIF", RasterImageFormat.CcittGroup4, image.BitsPerPixel, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite)

         ' Clean up
         image.Dispose()
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
CodecsTiffOptions 
      public void CodecsTiffOptionsExample() 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
 
         string srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\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; 
         } 
 
         codecs.Options.Tiff.Load.UseImageFileDirectoryOffset = imageInfo.Tiff.IsImageFileDirectoryOffsetValid; 
         codecs.Options.Tiff.Save.UseImageFileDirectoryOffset = imageInfo.Tiff.IsImageFileDirectoryOffsetValid; 
 
         codecs.Options.Tiff.Load.IgnorePhotometricInterpretation = true; 
 
         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 
         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; 
 
         //saving the image 
         codecs.Save(image, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\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, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\testtiff2.TIF", RasterImageFormat.CcittGroup4, image.BitsPerPixel, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite); 
 
         // Clean up 
         image.Dispose(); 
         codecs.Dispose(); 
         RasterCodecs.Shutdown(); 
      }

Inheritance Hierarchy

System.Object
   Leadtools.Codecs.CodecsTiffOptions

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also