Class TiffOptions

Class TiffOptions

Namespace: Aspose.Imaging.ImageOptions
Assembly: Aspose.Imaging.dll (25.7.0)

The tiff file format options.Note that width and height tags will get overwritten on image creation by width and height parameters so there is no need to specify them directly.Note that many options return a default value but that does not mean that this option is set explicitly as a tag value. To verify the tag is present use Tags property or the corresponding IsTagPresent method.

[JsonObject(MemberSerialization.OptIn)]
   public class TiffOptions : ImageOptionsBase, IDisposable, ICloneable, IHasExifData, IHasXmpData, IHasMetadata
   {
   }

Inheritance

object DisposableObject ImageOptionsBase TiffOptions

Derived

BigTiffOptions

Implements

IDisposable , ICloneable , IHasExifData , IHasXmpData , IHasMetadata

Inherited Members

ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

This example demonstrates the use of different classes from SaveOptions Namespace for export purposes. An image of type Gif is loaded into an instance of Image and then exported out to several formats.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
   {
       image.Save(dir + "output.bmp", new Aspose.Imaging.ImageOptions.BmpOptions());
       image.Save(dir + "output.jpg", new Aspose.Imaging.ImageOptions.JpegOptions());
       image.Save(dir + "output.png", new Aspose.Imaging.ImageOptions.PngOptions());
       image.Save(dir + "output.tif", new Aspose.Imaging.FileFormats.Tiff.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default));
   }

The following example shows how to convert a multipage vector image to TIFF format in general way without referencing to a particular image type.

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
   string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
   string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.tiff");
   Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
   {
       exportOptions.MultiPageOptions = null;
       if (multipageImage != null && multipageImage.Pages != null && multipageImage.PageCount > 2)
       {
           exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
       }
       if (image is Aspose.Imaging.VectorImage)
       {
           exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
           exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
           exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
       }
       image.Save(outputFilePath, exportOptions);
   }

This examples make use of GraphicsPath and Graphics class to create and manipulate Figures on an Image surface. Example creates a new Image (of type Tiff), clears the surface and draws paths with the help of GraphicsPath class. At the end DrawPath method exposed by Graphics class is called to render the paths on surface.

using System.IO;
   using Aspose.Imaging;
   using Aspose.Imaging.FileFormats.Tiff;
   using Aspose.Imaging.Sources;
   using Aspose.Imaging.Shapes;
   using Aspose.Imaging.GraphicsPath;
   using Aspose.Imaging.Figure;
   System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create);
   Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
   {
      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
      graphics.Clear(Color.Wheat);
      Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();
      Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();
      figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
      figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
      figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));
      graphicspath.AddFigure(figure);
      graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);
      image.Save();
   }

Constructors

TiffOptions(TiffExpectedFormat, TiffByteOrder)

Initializes a new instance of the Aspose.Imaging.ImageOptions.TiffOptions class.

public TiffOptions(TiffExpectedFormat expectedFormat, TiffByteOrder byteOrder)
   {
   }

Parameters

expectedFormat TiffExpectedFormat

The expected tiff file format.

byteOrder TiffByteOrder

The tiff file format byte order to use.

TiffOptions(TiffExpectedFormat)

Initializes a new instance of the Aspose.Imaging.ImageOptions.TiffOptions class. By default little endian convention is used.

public TiffOptions(TiffExpectedFormat expectedFormat)
   {
      this.ExpectedFormat = expectedFormat;
      this._Compression = TiffCompressionType.None;
      this._Predictor = PredictorType.Huffman;
      this._Orientalia = false;
   }

Parameters

expectedFormat TiffExpectedFormat

The expected tiff file format.

Examples

The following example shows how to create a grayscale copy of an existing frame and add it to a TIFF image.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "multipage.tif", false);
   createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush brush =
           new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
               Aspose.Imaging.Color.Red,
               Aspose.Imaging.Color.Green);
       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
       gr.FillRectangle(brush, tiffImage.Bounds);
       Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
       createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
       createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
       createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };
       Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
       tiffImage.AddFrame(grayscaleFrame);
       tiffImage.Save();
   }

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(image.Width, image.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Yellow);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.FillRectangle(gradientBrush, image.Bounds);
       image.Save(dir + "output.tif", saveOptions);
   }

TiffOptions(TiffOptions)

Initializes a new instance of the Aspose.Imaging.ImageOptions.TiffOptions class.

public TiffOptions(TiffOptions options)
{
}

Parameters

options TiffOptions

The options to copy from.

TiffOptions(TiffDataType[])

Initializes a new instance of the Aspose.Imaging.ImageOptions.TiffOptions class.

public TiffOptions(TiffDataType[] tags)
   {
   }

Parameters

tags TiffDataType []

The tags to initialize options with.

Properties

AlphaStorage

Gets or sets the alpha storage option. Options other than Aspose.Imaging.FileFormats.Tiff.Enums.TiffAlphaStorage.Unspecifiedare used when there are more than 3 Aspose.Imaging.ImageOptions.TiffOptions.SamplesPerPixel defined.

public TiffAlphaStorage AlphaStorage
    {
        get;
        set;
    }

Property Value

TiffAlphaStorage

Artist

Gets or sets the artist.

public string Artist
   {
      get;
      set;
   }

Property Value

string

BitsPerPixel

Gets the bits per pixel.

public int BitsPerPixel
   {
      get;
   }

Property Value

int

BitsPerSample

Gets or sets the bits per sample.

public ushort[] BitsPerSample
{
    get;
    set;
}

Property Value

ushort []

Examples

This example shows how to create a TIFF image from scratch and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
   graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
   {
       tiffImage.Save(dir + "output.tif");
   }

The following example shows how to compose a mutlipage TIFF from individual raster images.

Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
   createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
   {
       Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
       Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
       for (int i = 1; i <= 5; i++)
       {
           Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
           createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
           Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
           Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
           gr.DrawString(i.ToString(), font, brush, 10, 10);
           Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
           tiffImage.AddFrame(frame);
       }
       Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
       tiffImage.ActiveFrame = tiffImage.Frames[1];
       tiffImage.RemoveFrame(0);
       activeFrame.Dispose();
       tiffImage.Save();
   }

The following example shows how to create a grayscale copy of an existing frame and add it to a TIFF image.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "multipage.tif", false);
   createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush brush =
           new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
               Aspose.Imaging.Color.Red,
               Aspose.Imaging.Color.Green);
       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
       gr.FillRectangle(brush, tiffImage.Bounds);
       Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
       createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
       createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
       createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };
       Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
       tiffImage.AddFrame(grayscaleFrame);
       tiffImage.Save();
   }

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(image.Width, image.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Yellow);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.FillRectangle(gradientBrush, image.Bounds);
       image.Save(dir + "output.tif", saveOptions);
   }

This example shows how to create a TIFF image with 2 frames and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(frame1.Width, frame1.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
   graphics.FillRectangle(gradientBrush, frame1.Bounds);
   Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions2.BitsPerSample = new ushort[] { 1 };
   createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
   createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
   createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
   Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
   graphics2.FillRectangle(gradientBrush, frame2.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
   {
       tiffImage.Save(dir + "output.multiframe.tif");
   }

Remarks

When setting this value keep in mind that it will also set SamplesPerPixel value to array length. These 2 properties are very tightly coupled so may be set alltogether only.

ByteOrder

Gets or sets a value indicating the tiff byte order.

public TiffByteOrder ByteOrder
    {
        get;
        set;
    }

Property Value

TiffByteOrder

Examples

This example shows how to create a TIFF image from scratch and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
      new Aspose.Imaging.Point(0, 0),
      new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
      Aspose.Imaging.Color.Blue,
      Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
   graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
   {
      tiffImage.Save(dir + "output.tif");
   }

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
      Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
            new Aspose.Imaging.Point(0, 0),
            new Aspose.Imaging.Point(image.Width, image.Height),
            Aspose.Imaging.Color.Blue,
            Aspose.Imaging.Color.Yellow);
      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
      graphics.FillRectangle(gradientBrush, image.Bounds);
      image.Save(dir + "output.tif", saveOptions);
   }

This example shows how to create a TIFF image with 2 frames and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(frame1.Width, frame1.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
   graphics.FillRectangle(gradientBrush, frame1.Bounds);
   Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions2.BitsPerSample = new ushort[] { 1 };
   createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
   createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
   createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
   Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
   graphics2.FillRectangle(gradientBrush, frame2.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(
       new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
   {
       tiffImage.Save(dir + "output.mutliframe.tif");
   }

ColorMap

Gets or sets the color map.

public ushort[] ColorMap
   {
      get;
      set;
   }

Property Value

ushort []

Exceptions

ArgumentNullException

value

TiffImageException

The color map may be defined for samples per pixel equal to 1 only.orThe bits per sample are not defined.

ArgumentOutOfRangeException

value;The array length must correspond to the followign formula: 3 * (2**BitsPerSample).

CompressedQuality

Gets or sets compressed image quality.Used with the Jpeg compression.

public int CompressedQuality
   {
      get;
      set;
   }

Property Value

int

Examples

This example shows how to create a TIFF image with the Jpeg compression and the specified compressed image quality.

using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = Aspose.Imaging.Image.Load(@"c:\temp\zeebra.tif"))
   {
       var tiffOptions = new Aspose.Imaging.FileFormats.Tiff.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
       tiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
       tiffOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Jpeg;
       tiffOptions.CompressedQuality = 50;
       tiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
       image.Save("zeebra.tif-50.tiff", tiffOptions);
   }

Compression

Gets or sets the compression.

public TiffCompressions Compression
    {
        get;
        set;
    }

Property Value

TiffCompressions

Examples

This example shows how to create a TIFF image from scratch and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
   graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
   {
      tiffImage.Save(dir + "output.tif");
   }

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(image.Width, image.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Yellow);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.FillRectangle(gradientBrush, image.Bounds);
       image.Save(dir + "output.tif", saveOptions);
   }

This example shows how to create a TIFF image with 2 frames and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(frame1.Width, frame1.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
   graphics.FillRectangle(gradientBrush, frame1.Bounds);
   Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions2.BitsPerSample = new ushort[] { 1 };
   createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
   createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
   createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
   Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
   graphics2.FillRectangle(gradientBrush, frame2.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
   {
       tiffImage.Save(dir + "output.multiframe.tif");
   }

Copyright

Gets or sets the copyright.

public string Copyright
{
    get
    {
    }
    set
    {
    }
}

Property Value

string

DateTime

Gets or sets the date and time.

public string DateTime
    {
        get;
        set;
    }

Property Value

string

DefaultMemoryAllocationLimit

Gets or sets the default memory allocation limit.

using System;
namespace YourNamespace // <-- replace with actual namespace
{
    [Obsolete("Use Aspose.Imaging.Image.BufferSizeHint, Aspose.Imaging.ImageOptionsBase.BufferSizeHint or Aspose.Imaging.LoadOptions.BufferSizeHint instead.")]
    public class YourClass // <-- replace with actual class name
    {
        public int DefaultMemoryAllocationLimit { get; set; }
    }
}

Property Value

int

DisableIccExport

Gets or sets a value indicating whether ICC profile export is disabled (ICC profile is applied to the source pixels beforehand).

public classMyClass
{
    [JsonProperty]
    public bool DisableIccExport { get; set; }
}

Property Value

bool

DocumentName

Gets or sets the name of the document.

public string DocumentName
   {
      get;
      set;
   }

Property Value

string

ExifData

Gets or sets Exif data.

public ExifData ExifData
   {
      get;
      set;
   }

Property Value

ExifData

ExifIfd

Gets or sets the pointer to EXIF IFD.

public TiffExifIfd ExifIfd { get; } // Keeping the comments intact
   {
   }

Property Value

TiffExifIfd

ExtraSamples

Gets the extra samples values.

public ushort[] ExtraSamples
   {
      get;
   }

Property Value

ushort []

FaxT4Options

Gets or sets the fax t4 options.

public Group3Options FaxT4Options
   {
      get;
      set;
   }

Property Value

Group3Options

FileStandard

Gets or sets the TIFF file standard.

public TiffFileStandards
      FileStandard
      {
         get;
         set;
      }

Property Value

TiffFileStandards

FillOrder

Gets or sets the byte bits fill order.

public TiffFillOrders FillOrder
   {
      get;
      set;
   }

Property Value

TiffFillOrders

HalfToneHints

Gets or sets the halftone hints.

public ushort[] HalfToneHints
{
    get
    {
    }
    set
    {
    }
}

Property Value

ushort []

Exceptions

ArgumentNullException

value

ArgumentOutOfRangeException

value;Halftone hints array length must be equal to 2.

IccProfile

Gets or sets the Icc profile stream.

public MemoryStream IccProfile
    {
        get;
        set;
    }

Property Value

MemoryStream

ImageDescription

Gets or sets the image description.

public string ImageDescription
    {
        get;
        set;
    }

Property Value

string

ImageLength

Gets or sets the image length.

public uint ImageLength
   {
      get;
      set;
   }

Property Value

uint

ImageWidth

Gets or sets the image width.

public uint ImageWidth
    {
        get;
        set;
    }

Property Value

uint

InkNames

Gets or sets the ink names.

public string InkName { get; set; }

Property Value

string

IsExtraSamplesPresent

Gets a value indicating whether the extra samples is present.

public bool IsExtraSamplesPresent
   {
      get;
   }

Property Value

bool

IsTiled

Gets a value indicating whether image is tiled.

public bool IsTiled
   {
      get;
   }

Property Value

bool

IsValid

Gets a value indicating whether the Aspose.Imaging.ImageOptions.TiffOptions have been properly configured. Use Validate method as to find the failure reason.

public bool IsValid
   {
      get;
   }

Property Value

bool

MaxSampleValue

Gets or sets the max sample value.

public uint[] MaxSampleValue
   {
      get { return this.MaxSampleValue; }
      set { this.MaxSampleValue = value; }
   }

Property Value

ushort []

Exceptions

ArgumentNullException

value

ArgumentOutOfRangeException

value;The array length must correspond to the samples per pixel count.

MinSampleValue

Gets or sets the min sample value.

public uint[] MinSampleValue
   {
      get
      {
         return this.MinSampleValue;
      }
      set
      {
         this.MinSampleValue = value;
      }
   }

Property Value

ushort []

Exceptions

ArgumentNullException

value

ArgumentOutOfRangeException

value;The array length must correspond to the samples per pixel count.

Orientation

Gets or sets the orientation.

public TiffOrientations Orientation
    {
        get;
        set;
    }

Property Value

TiffOrientations

PageName

Gets or sets the page name.

public string PageName
   {
      get;
      set;
   }

Property Value

string

PageNumber

Gets or sets the page number tag.

public ushort[] PageNumber
{
    get;
    set;
}

Property Value

ushort []

Exceptions

ArgumentNullException

value

ArgumentOutOfRangeException

value;Expected 2 values in the array: PageNumber[0] is the page number and PageNumber[1] is the total number of pages in the document.

Palette

Gets or sets the color palette.

public override IColorPalette Palette
    {
        get;
        set;
    }

Property Value

IColorPalette

Photometric

Gets or sets the photometric.

public TiffPhotometrics Photometric
   {
      get;
      set;
   }

Property Value

TiffPhotometrics

Examples

This example shows how to create a TIFF image from scratch and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
   graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
   {
       tiffImage.Save(dir + "output.tif");
   }

The following example shows how to compose a mutlipage TIFF from individual raster images.

Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
   createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
   {
       Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
       Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
       for (int i = 1; i <= 5; i++)
       {
           Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
           createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
           Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
           Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
           gr.DrawString(i.ToString(), font, brush, 10, 10);
           Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
           tiffImage.AddFrame(frame);
       }
       Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
       tiffImage.ActiveFrame = tiffImage.Frames[1];
       tiffImage.RemoveFrame(0);
       activeFrame.Dispose();
       tiffImage.Save();
   }

The following example shows how to create a grayscale copy of an existing frame and add it to a TIFF image.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "multipage.tif", false);
   createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush brush =
           new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
               Aspose.Imaging.Color.Red,
               Aspose.Imaging.Color.Green);
       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
       gr.FillRectangle(brush, tiffImage.Bounds);
       Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
       createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
       createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
       createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };
       Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
       tiffImage.AddFrame(grayscaleFrame);
       tiffImage.Save();
   }

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
      Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
            new Aspose.Imaging.Point(0, 0),
            new Aspose.Imaging.Point(image.Width, image.Height),
            Aspose.Imaging.Color.Blue,
            Aspose.Imaging.Color.Yellow);
      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
      graphics.FillRectangle(gradientBrush, image.Bounds);
      image.Save(dir + "output.tif", saveOptions);
   }

This example shows how to create a TIFF image with 2 frames and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(frame1.Width, frame1.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
   graphics.FillRectangle(gradientBrush, frame1.Bounds);
   Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions2.BitsPerSample = new ushort[] { 1 };
   createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
   createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
   createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
   Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
   graphics2.FillRectangle(gradientBrush, frame2.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
   {
       tiffImage.Save(dir + "output.mutliframe.tif");
   }

PlanarConfiguration

Gets or sets the planar configuration.

public TiffPlanarConfigs PlanarConfiguration
    {
        get;
        set;
    }

Property Value

TiffPlanarConfigs

Examples

This example shows how to create a TIFF image from scratch and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
      new Aspose.Imaging.Point(0, 0),
      new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
      Aspose.Imaging.Color.Blue,
      Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
   graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
   {
      tiffImage.Save(dir + "output.tif");
   }

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(image.Width, image.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Yellow);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.FillRectangle(gradientBrush, image.Bounds);
       image.Save(dir + "output.tif", saveOptions);
   }

This example shows how to create a TIFF image with 2 frames and save it to a file.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
   createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
   Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
       new Aspose.Imaging.Point(0, 0),
       new Aspose.Imaging.Point(frame1.Width, frame1.Height),
       Aspose.Imaging.Color.Blue,
       Aspose.Imaging.Color.Yellow);
   Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
   graphics.FillRectangle(gradientBrush, frame1.Bounds);
   Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   createOptions2.BitsPerSample = new ushort[] { 1 };
   createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
   createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
   createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
   Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
   Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
   graphics2.FillRectangle(gradientBrush, frame2.Bounds);
   using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
   {
       tiffImage.Save(dir + "output.multiframe.tif");
   }

Predictor

Gets or sets the predictor for LZW compression.

public TiffPredictor Predicator
   {
      get;
      set;
   }

Property Value

TiffPredictor

Examples

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(image.Width, image.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Yellow);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.FillRectangle(gradientBrush, image.Bounds);
       image.Save(dir + "output.tif", saveOptions);
   }

PremultiplyComponents

Gets or sets a value indicating whether components must be premultiplied.

[JsonProperty]
   public bool PremultiplyComponents
   {
       get;
       set;
   }

Property Value

bool

ResolutionSettings

Gets or sets the resolution settings.

public override ResolutionSetting ResolutionSettings
{
    get;
    set;
}

Property Value

ResolutionSetting

ResolutionUnit

Gets or sets the resolution unit.

public TiffResolutionUnits ResolutionUnit
    {
        get;
        set;
    }

Property Value

TiffResolutionUnits

RowsPerStrip

Gets or sets the rows per strip.

public uint RowsPerStrip
   {
      get;
      set;
   }

Property Value

uint

SampleFormat

Gets or sets the sample format.

public TiffSampleFormats[] SampleFormats
    {
        get;
        set;
    }

Property Value

TiffSampleFormats []

Exceptions

ArgumentNullException

value

ArgumentOutOfRangeException

value;The array length must correspond to the samples per pixel count.

SamplesPerPixel

Gets the samples per pixel. To change this property value use the Aspose.Imaging.ImageOptions.TiffOptions.BitsPerSample property setter.

public ushort SamplesPerPixel
   {
      get;
   }

Property Value

ushort

ScannerManufacturer

Gets or sets the scanner manufacturer.

public string ScannerManufacturer
    {
        get;
        set;
    }

Property Value

string

ScannerModel

Gets or sets the scanner model.

public string ScannerModel
    {
        get;
        set;
    }

Property Value

string

SmaxSampleValue

Gets or sets the max sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).

public uint[] SmaxSampleValue
{
    get;
    set;
}

Property Value

uint []

SminSampleValue

Gets or sets the min sample value. The value has a field type which best matches the sample data (Byte, Short or Long type).

public uint[] SminSampleValue
{
    get;
    set;
}

Property Value

uint []

SoftwareType

Gets or sets the software type.

public string SoftwareType
    {
        get;
        set;
    }

Property Value

string

StripByteCounts

Gets or sets the strip byte counts.

public ulong[] StripByteCounts
{
    get { return this.StripByteCounts; }
    set { this.StripByteCounts = value; }
}

Property Value

ulong []

StripOffsets

Gets or sets the strip offsets.

public ulong[] StripOffsets
    {
        get;
        set;
    }

Property Value

ulong []

SubFileType

Gets or sets a general indication of the kind of data contained in this subfile.

public TiffNewSubFileType SubFileType
   {
      get;
      set;
   }

Property Value

TiffNewSubFileTypes

TagCount

Gets the tag count.

public int TagCount
   {
      get;
   }

Property Value

int

Tags

Gets or sets the tags.

public TiffDataType[] Tags
{
    get;
    set;
}

Property Value

TiffDataType []

TargetPrinter

Gets or sets the target printer.

public string TargetPrinter
   {
      get;
      set;
   }

Property Value

string

Threshholding

Gets or sets the threshholding.

public TiffThresholds Thresholdning
   {
      get;
      set;
   }

Property Value

TiffThresholds

TileByteCounts

Gets or sets the tile byte counts.

public ulong[] TileByteCounts
{
    get;
    set;
}

Property Value

ulong []

TileLength

Gets ot sets tile length.

public uint TileLength
    {
        get;
        set;
    }

Property Value

uint

TileOffsets

Gets or sets the tile offsets.

public ulong[] TileOffsets
{
    get;
    set;
}

Property Value

ulong []

TileWidth

Gets ot sets tile width.

public uint TileWidth
   {
      get;
      set;
   }

Property Value

uint

TotalPages

Gets the total pages.

public uint TotalPages
   {
      get;
   }

Property Value

ushort

ValidTagCount

Gets the valid tag count. This is not the total tags count but the number of tags which may be preserved.

public int ValidTagCount
   {
      get;
   }

Property Value

int

XPAuthor

Gets or sets image author, which used by Windows Explorer.

public string XPAuthor
   {
      get;
      set;
   }

Property Value

string

XPComment

Gets or sets comment on image, which used by Windows Explorer.

public string XPComment
    {
        get;
        set;
    }

Property Value

string

XPKeywords

Gets or sets subject image, which used by Windows Explorer.

public string XPKeywords
{
    get;
    set;
}

Property Value

string

XPSubject

Gets or sets information about image, which used by Windows Explorer.

public string XPSubject
   {
      get;
      set;
   }

Property Value

string

XPTitle

Gets or sets information about image, which used by Windows Explorer.

public string XPTitle
    {
        get;
        set;
    }

Property Value

string

Xposition

Gets or sets the x position.

public TiffRational XPosition
   {
      get;
      set;
   }

Property Value

TiffRational

Xresolution

Gets or sets the x resolution.

public TiffRational XResolution // <-- Note that I've preserved your existing comment here
{
    get;
    set;
}

Property Value

TiffRational

YCbCrCoefficients

Gets or sets the YCbCrCoefficients.

public TiffRational[] YCbCrCoefficients
   {
      get;
      set;
   }

Property Value

TiffRational []

Exceptions

TiffImageException

Invalid count of rational coefficient values. Must be equal to 3.

ArgumentNullException

value

YCbCrSubsampling

Gets or sets the subsampling factors for YCbCr photometric.

public ushort[] YCbCrSubsampling
{
    get;
    set;
}

Property Value

ushort []

Examples

This example shows how to save a raster image to the TIFF format using various options.

string dir = "c:\\temp\\";
   Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
   saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
   saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
   saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
   saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;
   saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
   saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
   using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
   {
       Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
               new Aspose.Imaging.Point(0, 0),
               new Aspose.Imaging.Point(image.Width, image.Height),
               Aspose.Imaging.Color.Blue,
               Aspose.Imaging.Color.Yellow);
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.FillRectangle(gradientBrush, image.Bounds);
       image.Save(dir + "output.tif", saveOptions);
   }

Exceptions

TiffImageException

Invalid field length. YCbCrSubsampling field must contain two values.

ArgumentNullException

value

Yposition

Gets or sets the y position.

public TiffRational yPosition // Note: Consistent naming convention for property accessors (lowercase 'p')
   {
      get; // No need to leave empty line after get;
      set; // No need to leave empty line after set;
   }

Property Value

TiffRational

Yresolution

Gets or sets the y resolution.

public TiffRational YResolution
   {
      get;
      set;
   }

Property Value

TiffRational

Methods

AddTag(TiffDataType)

Adds a new tag.

public void AddTag(TiffDataType tagToAdd)
   {
   }

Parameters

tagToAdd TiffDataType

The tag to add.

AddTags(TiffDataType[])

Adds the tags.

public void AddTags(TiffDataType[] tagsToAdd)
   {
   }

Parameters

tagsToAdd TiffDataType []

The tags to add.

Clone()

Clones this instance.

public override ImageOptionsBase Clone()
{
    return (ImageOptionsBase)MemberwiseClone();
}

Returns

ImageOptionsBase

Returns a deep clone.

GetTagByType(TiffTags)

Gets the instance of the tag by type.

public TiffDataType GetTagByType(TiffTags tagKey)
    {
        switch (tagKey)
        {
            case TiffTags.SubFileType: return _tiffSubFileType;
            case TiffTags.ImageDescription: return _imageDescription;
        }
    }

Parameters

tagKey TiffTags

The tag key.

Returns

TiffDataType

Instance of the tag if exists or null otherwise.

GetValidTagsCount(TiffDataType[])

Gets the valid tags count.

public static int GetValidTagsCount(TiffDataType[] tags)
   {
      int count = 0;
      foreach (var tag in tags)
      {
         if (tag.TagType == TiffDataTypeTagType.Valid)
            count++;
      }
      return count;
   }

Parameters

tags TiffDataType []

The tags to validate.

Returns

int

The valid tags count.

IsTagPresent(TiffTags)

Determines whether tag is present in the options or not.

public bool IsTagPresent(TiffTags tag)
{
    if (tiffData.Tags != null && tiffData.Tags.Any(x => x.TagId == tag))
        return true;
    return false;
}

Parameters

tag TiffTags

The tag id to check.

Returns

bool

’true’ if tag is present; otherwise, ‘false’.

RemoveTag(TiffTags)

Removes the tag.

public bool RemoveTag(TiffTags tag)
{
}

Parameters

tag TiffTags

The tag to remove.

Returns

bool

true if successfully removed

RemoveTags(params TiffTags[])

Removes the tags.

public bool RemoveTags(params TiffTags[] tags)
{
}

Parameters

tags TiffTags []

The tags to remove.

Returns

bool

true if tag collection size changed.

Validate()

Validates if options have valid combination of tags

public void Validate()
   {
   }
I have properly indented the code, added necessary spacing, and made general readability improvements as requested.
 English