Class TiffImage

Class TiffImage

Namespace: Aspose.Imaging.FileFormats.Tiff
Assembly: Aspose.Imaging.dll (25.2.0)

Process Tagged Image File Format (TIFF) raster images with our API, offering comprehensive support for various resolutions and advanced editing capabilities like EXIF data manipulation and alpha channels. Normalize angles for scanned images, resize, transform to grayscale, and apply filters, gamma corrections and image parameters adjustments with ease. Seamlessly handle multi-frame TIFF files, create graphics paths, add shapes, and effortlessly save images to different formats.

[JsonObject(MemberSerialization.OptIn)]
public class TiffImage : RasterCachedMultipageImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IMultipageImageExt, IMultipageImage, IHasExifData, IHasXmpData, IHasMetadata

Inheritance

objectDisposableObjectDataStreamSupporterImageRasterImageRasterCachedImageRasterCachedMultipageImageTiffImage

Derived

BigTiffImage

Implements

IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IMultipageImageExt, IMultipageImage, IHasExifData, IHasXmpData, IHasMetadata

Inherited Members

RasterCachedMultipageImage.AdjustBrightness(int), RasterCachedMultipageImage.AdjustContrast(float), RasterCachedMultipageImage.AdjustGamma(float, float, float), RasterCachedMultipageImage.AdjustGamma(float), RasterCachedMultipageImage.Blend(Point, RasterImage, Rectangle, byte), RasterCachedMultipageImage.BinarizeFixed(byte), RasterCachedMultipageImage.BinarizeBradley(double, int), RasterCachedMultipageImage.BinarizeBradley(double), RasterCachedMultipageImage.BinarizeOtsu(), RasterCachedMultipageImage.Crop(Rectangle), RasterCachedMultipageImage.Crop(int, int, int, int), RasterCachedMultipageImage.Dither(DitheringMethod, int, IColorPalette), RasterCachedMultipageImage.Grayscale(), RasterCachedMultipageImage.Rotate(float, bool, Color), RasterCachedMultipageImage.RotateFlip(RotateFlipType), RasterCachedMultipageImage.RotateFlipAll(RotateFlipType), RasterCachedMultipageImage.Resize(int, int, ResizeType), RasterCachedMultipageImage.Resize(int, int, ImageResizeSettings), RasterCachedMultipageImage.ResizeWidthProportionally(int, ResizeType), RasterCachedMultipageImage.ResizeHeightProportionally(int, ResizeType), RasterCachedMultipageImage.ReplaceColor(int, byte, int), RasterCachedMultipageImage.ReplaceNonTransparentColors(int), RasterCachedMultipageImage.Filter(Rectangle, FilterOptionsBase), RasterCachedMultipageImage.NormalizeAngle(bool, Color), RasterCachedMultipageImage.CacheData(), RasterCachedMultipageImage.ReleaseManagedResources(), RasterCachedMultipageImage.ResizeMain(int, int, ResizeType), RasterCachedMultipageImage.RotateFlipMain(RotateFlipType), RasterCachedMultipageImage.CropMain(int, int, int, int), RasterCachedMultipageImage.SavePixelsInternalMain(Rectangle, int[]), RasterCachedMultipageImage.CanDoAdjustments(), RasterCachedMultipageImage.GetPagesAsEnumerable(), RasterCachedMultipageImage.GetSerializedStream(ImageOptionsBase, Rectangle, out int), RasterCachedMultipageImage.Height, RasterCachedMultipageImage.Width, RasterCachedMultipageImage.BitsPerPixel, RasterCachedMultipageImage.IsCached, RasterCachedMultipageImage.PageCount, RasterCachedMultipageImage.Pages, RasterCachedMultipageImage.HasAlpha, RasterCachedMultipageImage.HasTransparentColor, RasterCachedMultipageImage.ImageOpacity, RasterCachedMultipageImage.BackgroundColor, RasterCachedMultipageImage.XmpData, RasterCachedMultipageImage.PageExportingAction, RasterCachedImage.CacheData(), RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte), RasterCachedImage.Resize(int, int, ResizeType), RasterCachedImage.Resize(int, int, ImageResizeSettings), RasterCachedImage.RotateFlip(RotateFlipType), RasterCachedImage.Rotate(float, bool, Color), RasterCachedImage.Crop(Rectangle), RasterCachedImage.Dither(DitheringMethod, int, IColorPalette), RasterCachedImage.Grayscale(), RasterCachedImage.BinarizeFixed(byte), RasterCachedImage.BinarizeOtsu(), RasterCachedImage.BinarizeBradley(double, int), RasterCachedImage.BinarizeBradley(double), RasterCachedImage.AdjustBrightness(int), RasterCachedImage.AdjustContrast(float), RasterCachedImage.AdjustGamma(float, float, float), RasterCachedImage.AdjustGamma(float), RasterCachedImage.OnCached(), RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette), RasterCachedImage.IsCached, RasterImage.xmpData, RasterImage.RemoveMetadata(), RasterImage.Save(Stream, ImageOptionsBase, Rectangle), RasterImage.GetModifyDate(bool), RasterImage.Dither(DitheringMethod, int), RasterImage.Dither(DitheringMethod, int, IColorPalette), RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings), RasterImage.GetDefaultArgb32Pixels(Rectangle), RasterImage.GetDefaultRawData(Rectangle, RawDataSettings), RasterImage.GetArgb32Pixel(int, int), RasterImage.GetPixel(int, int), RasterImage.SetArgb32Pixel(int, int, int), RasterImage.SetPixel(int, int, Color), RasterImage.ReadScanLine(int), RasterImage.ReadArgb32ScanLine(int), RasterImage.WriteScanLine(int, Color[]), RasterImage.WriteArgb32ScanLine(int, int[]), RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader), RasterImage.LoadArgb32Pixels(Rectangle), RasterImage.LoadArgb64Pixels(Rectangle), RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader), RasterImage.LoadPixels(Rectangle), RasterImage.LoadCmykPixels(Rectangle), RasterImage.LoadCmyk32Pixels(Rectangle), RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings), RasterImage.SaveArgb32Pixels(Rectangle, int[]), RasterImage.SavePixels(Rectangle, Color[]), RasterImage.SaveCmykPixels(Rectangle, CmykColor[]), RasterImage.SaveCmyk32Pixels(Rectangle, int[]), RasterImage.SetResolution(double, double), RasterImage.SetPalette(IColorPalette, bool), RasterImage.Resize(int, int, ImageResizeSettings), RasterImage.Rotate(float, bool, Color), RasterImage.Rotate(float), RasterImage.BinarizeFixed(byte), RasterImage.BinarizeOtsu(), RasterImage.BinarizeBradley(double), RasterImage.BinarizeBradley(double, int), RasterImage.Blend(Point, RasterImage, Rectangle, byte), RasterImage.Blend(Point, RasterImage, byte), RasterImage.Grayscale(), RasterImage.AdjustBrightness(int), RasterImage.AdjustContrast(float), RasterImage.AdjustGamma(float, float, float), RasterImage.AdjustGamma(float), RasterImage.GetSkewAngle(), RasterImage.NormalizeAngle(), RasterImage.NormalizeAngle(bool, Color), RasterImage.Filter(Rectangle, FilterOptionsBase), RasterImage.ReplaceColor(Color, byte, Color), RasterImage.ReplaceColor(int, byte, int), RasterImage.ReplaceNonTransparentColors(Color), RasterImage.ReplaceNonTransparentColors(int), RasterImage.ToBitmap(), RasterImage.ReleaseManagedResources(), RasterImage.UpdateMetadata(), RasterImage.UpdateDimensions(int, int), RasterImage.PremultiplyComponents, RasterImage.UseRawData, RasterImage.UpdateXmpData, RasterImage.XmpData, RasterImage.RawIndexedColorConverter, RasterImage.RawCustomColorConverter, RasterImage.RawFallbackIndex, RasterImage.RawDataSettings, RasterImage.UsePalette, RasterImage.RawDataFormat, RasterImage.RawLineSize, RasterImage.IsRawDataAvailable, RasterImage.HorizontalResolution, RasterImage.VerticalResolution, RasterImage.HasTransparentColor, RasterImage.HasAlpha, RasterImage.TransparentColor, RasterImage.ImageOpacity, RasterImage.DataLoader, Image.CanLoad(string), Image.CanLoad(string, LoadOptions), Image.CanLoad(Stream), Image.CanLoad(Stream, LoadOptions), Image.Create(ImageOptionsBase, int, int), Image.Create(Image[]), Image.Create(MultipageCreateOptions), Image.Create(string[], bool), Image.Create(string[]), Image.Create(Image[], bool), Image.GetFileFormat(string), Image.GetFileFormat(Stream), Image.GetFittingRectangle(Rectangle, int, int), Image.GetFittingRectangle(Rectangle, int[], int, int), Image.Load(string, LoadOptions), Image.Load(string), Image.Load(Stream, LoadOptions), Image.Load(Stream), Image.GetProportionalWidth(int, int, int), Image.GetProportionalHeight(int, int, int), Image.RemoveMetadata(), Image.CanSave(ImageOptionsBase), Image.Resize(int, int), Image.Resize(int, int, ResizeType), Image.Resize(int, int, ImageResizeSettings), Image.GetDefaultOptions(object[]), Image.GetOriginalOptions(), Image.ResizeWidthProportionally(int), Image.ResizeHeightProportionally(int), Image.ResizeWidthProportionally(int, ResizeType), Image.ResizeHeightProportionally(int, ResizeType), Image.ResizeWidthProportionally(int, ImageResizeSettings), Image.ResizeHeightProportionally(int, ImageResizeSettings), Image.RotateFlip(RotateFlipType), Image.Rotate(float), Image.Crop(Rectangle), Image.Crop(int, int, int, int), Image.Save(), Image.Save(string), Image.Save(string, ImageOptionsBase), Image.Save(string, ImageOptionsBase, Rectangle), Image.Save(Stream, ImageOptionsBase), Image.Save(Stream, ImageOptionsBase, Rectangle), Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int), Image.SetPalette(IColorPalette, bool), Image.UpdateContainer(Image), Image.GetCanNotSaveMessage(ImageOptionsBase), Image.GetFitRectangle(Rectangle), Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter), Image.GetFitRectangle(Rectangle, int[]), Image.OnPaletteChanged(IColorPalette, IColorPalette), Image.OnPaletteChanging(IColorPalette, IColorPalette), Image.ReleaseManagedResources(), Image.BitsPerPixel, Image.Bounds, Image.Container, Image.Height, Image.Palette, Image.UsePalette, Image.Size, Image.Width, Image.InterruptMonitor, Image.BufferSizeHint, Image.AutoAdjustPalette, Image.HasBackgroundColor, Image.FileFormat, Image.BackgroundColor, DataStreamSupporter.timeout, DataStreamSupporter.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.SaveData(Stream), DataStreamSupporter.ReleaseManagedResources(), DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, 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

Create Graphics Path from Path Resources in TIFF image.```csharp [C#]

                                                              using (var image = (TiffImage)Image.Load("Bottle.tif"))
                                                              {
                                                                  // Create the GraphicsPath using PathResources from TIFF image
                                                                  var graphicsPath = PathResourceConverter.ToGraphicsPath(image.ActiveFrame.PathResources.ToArray(), image.ActiveFrame.Size);
                                                                  var graphics = new Graphics(image);

                                                                  // Draw red line and save the image
                                                                  graphics.DrawPath(new Pen(Color.Red, 10), graphicsPath);
                                                                  image.Save("BottleWithRedBorder.tif");
                                                              }

Create Path Resources using Graphics Path.```csharp
[C#]

                                                     static void Main(string[] args)
                                                     {
                                                         using (var image = (TiffImage)Image.Load("Bottle.tif"))
                                                         {
                                                             // Create rectangular Figure for GraphicsPath
                                                             var figure = new Figure();
                                                             figure.AddShape(CreateBezierShape(100f, 100f, 500f, 100f, 500f, 1000f, 100f, 1000f));

                                                             // Create GraphicsPath using our Figure
                                                             var graphicsPath = new GraphicsPath();
                                                             graphicsPath.AddFigure(figure);

                                                             // Set PathResources using GraphicsPath
                                                             var pathResouze = PathResourceConverter.FromGraphicsPath(graphicsPath, image.Size);
                                                             image.ActiveFrame.PathResources = new List<pathresource>(pathResouze);

                                                             // Save the image
                                                             image.Save("BottleWithRectanglePath.tif");
                                                         }
                                                     }

                                                     private static BezierShape CreateBezierShape(params float[] coordinates)
                                                     {
                                                         var bezierPoints = CoordinatesToBezierPoints(coordinates).ToArray();
                                                         return new BezierShape(bezierPoints, true);
                                                     }

                                                     private static IEnumerable<pointf> CoordinatesToBezierPoints(float[] coordinates)
                                                     {
                                                         for (var coordinateIndex = 0; coordinateIndex &lt; coordinates.Length; coordinateIndex += 2)
                                                             for (var index = 0; index &lt; 3; index++)
                                                                 yield return new PointF(coordinates[coordinateIndex], coordinates[coordinateIndex + 1]);
                                                     }</pointf></pathresource>

Constructors

TiffImage(TiffFrame)

Initialize a new object of the Aspose.Imaging.FileFormats.Tiff.TiffImage class, specifying the frame parameter. This constructor facilitates the creation of a TiffImage instance, allowing developers to specify the frame to be loaded or processed, streamlining Tiff image handling tasks within their applications.

public TiffImage(TiffFrame frame)

Parameters

frame TiffFrame

The tiff frame to initialize image with.

Examples

This example shows how to create a TIFF image from scratch and save it to a file.```csharp [C#]

                                                                                        string dir = "c:\\temp\\";

                                                                                        Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                        // Set 8 bits for each color component.
                                                                                        createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                        // Set the Big Endian byte order (Motorola)
                                                                                        createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                        // Set the LZW compression.
                                                                                        createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                        // Set the RGB color model.
                                                                                        createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                        // All color components will be stored within a single plane.
                                                                                        createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                        // Create a TIFF Frame of 100x100 px.
                                                                                        // Note that you don't have to dispose a frame explicitly if it is included into TiffImage.
                                                                                        // When the container is disposed all frames will be disposed automatically.
                                                                                        Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);

                                                                                        // Fill the entire frame with the blue-yellow gradient.
                                                                                        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);

                                                                                        // Create a TIFF image.
                                                                                        using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
                                                                                        {
                                                                                            tiffImage.Save(dir + "output.tif");
                                                                                        }

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

Tiff <code class="paramref">frame</code> cannot be empty.

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage__ctor_Aspose_Imaging_FileFormats_Tiff_TiffFrame___"></a> TiffImage\(TiffFrame\[\]\)

Create a new instance of the Aspose.Imaging.FileFormats.Tiff.TiffImage class, providing a list of 
frames as a parameter. This constructor enables the initialization of a TiffImage 
object with multiple frames, facilitating efficient handling and processing of 
TIFF image sequences within software applications.

```csharp
public TiffImage(TiffFrame[] frames)

Parameters

frames TiffFrame[]

The frames.

Examples

This example shows how to create a TIFF image with 2 frames and save it to a file.```csharp [C#]

                                                                                         string dir = "c:\\temp\\";

                                                                                         // Options for the first frame
                                                                                         Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                         // Set 8 bits for each color component.
                                                                                         createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                         // Set the Big Endian byte order (Motorola)
                                                                                         createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                         // Set the LZW compression.
                                                                                         createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                         // Set the RGB color model.
                                                                                         createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                         // All color components will be stored within a single plane.
                                                                                         createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                         // Create the first TIFF frame of 100x100 px.
                                                                                         // Note that you don't have to dispose frames explicitly if they are included into TiffImage.
                                                                                         // When the container is disposed all frames will be disposed automatically.
                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);

                                                                                         // Fill the first frame with the blue-yellow gradient.
                                                                                         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);

                                                                                         // Options for the first frame
                                                                                         Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                         // Set 1 bit per pixel for a B/W image.
                                                                                         createOptions2.BitsPerSample = new ushort[] { 1 };

                                                                                         // Set the Little Endian byte order (Intel)
                                                                                         createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;

                                                                                         // Set the CCITT Group 3 Fax compression.
                                                                                         createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;

                                                                                         // Set the B/W color model where 0 is black, 1 is white.
                                                                                         createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;

                                                                                         // Create the second TIFF frame of 200x200px.
                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);

                                                                                         // Fill the second frame with the blue-yellow gradient.
                                                                                         // It will be automatically converted to the B/W format due to the corresponding settings of the frame.
                                                                                         Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
                                                                                         graphics2.FillRectangle(gradientBrush, frame2.Bounds);

                                                                                         // Create a TIFF image.
                                                                                         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");
                                                                                         }

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

frames

## Properties

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_ActiveFrame"></a> ActiveFrame

Manage the active frame seamlessly, facilitating dynamic navigation and 
manipulation within the designated context. Empower your application to interact 
efficiently with multimedia content, enhancing user engagement and productivity.

```csharp
public TiffFrame ActiveFrame { get; set; }

Property Value

TiffFrame

Examples

The following example shows how to compose a mutlipage TIFF from individual raster images.```csharp [C#]

                                                                                                 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))
                                                                                                 {
                                                                                                     // This is Font and Brush for drawing text on individual frames.
                                                                                                     Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
                                                                                                     Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);

                                                                                                     // Create 5 frames
                                                                                                     for (int i = 1; i &lt;= 5; i++)
                                                                                                     {
                                                                                                         Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                         createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());

                                                                                                         // Create a PNG image and draw the number of page on it.
                                                                                                         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);

                                                                                                         // Create a frame based on the PNG image.
                                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);

                                                                                                         // Add the frame to the TIFF image.
                                                                                                         tiffImage.AddFrame(frame);
                                                                                                     }

                                                                                                     // The image was created with a single default frame. Let's remove it.
                                                                                                     Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
                                                                                                     tiffImage.ActiveFrame = tiffImage.Frames[1];
                                                                                                     tiffImage.RemoveFrame(0);

                                                                                                     // Don't forget to dispose the frame if you won't add it to some other TiffImage
                                                                                                     activeFrame.Dispose();

                                                                                                     tiffImage.Save();
                                                                                                 }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_ByteOrder"></a> ByteOrder

Toggle the byte order for TIFF files seamlessly, ensuring precise control over 
data interpretation. Empower your applications with the flexibility to adapt to 
diverse file specifications, enhancing compatibility and efficiency in data processing.

```csharp
public TiffByteOrder ByteOrder { get; set; }

Property Value

TiffByteOrder

ExifData

Access or modify EXIF data associated with the active frame seamlessly, empowering precise control over image metadata. Enhance your application’s capabilities by integrating this feature, ensuring accurate preservation and customization of essential image information.

public ExifData ExifData { get; set; }

Property Value

ExifData

FileFormat

Retrieve the file format value associated with the image. This property serves as a critical aspect of image metadata retrieval, allowing software applications to identify and interpret the format of the image data efficiently.

public override FileFormat FileFormat { get; }

Property Value

FileFormat

Frames

Retrieve an array of Aspose.Imaging.FileFormats.Tiff.TiffFrame instances, enabling comprehensive access and manipulation of individual frames within the TIFF image. Harness the power of this array to streamline image processing workflows, ensuring precise control and optimization of visual content.

public TiffFrame[] Frames { get; }

Property Value

TiffFrame[]

Examples

The following example shows how to compose a mutlipage TIFF from individual raster images.```csharp [C#]

                                                                                                 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))
                                                                                                 {
                                                                                                     // This is Font and Brush for drawing text on individual frames.
                                                                                                     Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
                                                                                                     Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);

                                                                                                     // Create 5 frames
                                                                                                     for (int i = 1; i &lt;= 5; i++)
                                                                                                     {
                                                                                                         Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                         createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());

                                                                                                         // Create a PNG image and draw the number of page on it.
                                                                                                         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);

                                                                                                         // Create a frame based on the PNG image.
                                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);

                                                                                                         // Add the frame to the TIFF image.
                                                                                                         tiffImage.AddFrame(frame);
                                                                                                     }

                                                                                                     // The image was created with a single default frame. Let's remove it.
                                                                                                     Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
                                                                                                     tiffImage.ActiveFrame = tiffImage.Frames[1];
                                                                                                     tiffImage.RemoveFrame(0);

                                                                                                     // Don't forget to dispose the frame if you won't add it to some other TiffImage
                                                                                                     activeFrame.Dispose();

                                                                                                     tiffImage.Save();
                                                                                                 }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_HasAlpha"></a> HasAlpha

Determine whether the image has an alpha channel, providing crucial information 
for rendering and compositing operations. Integrate this feature to optimize 
visual processing workflows, ensuring accurate representation and manipulation of 
transparent elements.

```csharp
public override bool HasAlpha { get; }

Property Value

bool

Examples

The following example loads a TIFF image and prints information about raw data format and alpha channel.```csharp [C#]

                                                                                                               string dir = "c:\\temp\\";

                                                                                                               string fileName = dir + "sample.tif";
                                                                                                               using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
                                                                                                               {
                                                                                                                   Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                   // If the active TIFF frame has alpha channel, then the entire TIFF image is considered to have alpha channel.
                                                                                                                   System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, tiffImage.RawDataFormat, tiffImage.HasAlpha);

                                                                                                                   int i = 0;
                                                                                                                   foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
                                                                                                                   {
                                                                                                                       System.Console.WriteLine("Frame={0}, FileFormat={1}, HasAlpha={2}", ++i, frame.RawDataFormat, frame.HasAlpha);
                                                                                                                   }
                                                                                                               }

                                                                                                               // The output may look like this:
                                                                                                               // ImageFile=c:\temp\sample.tif, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
                                                                                                               // Frame=1, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
                                                                                                               // Frame=2, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_HorizontalResolution"></a> HorizontalResolution

Retrieve the horizontal resolution of the specified Aspose.Imaging.Image in pixels 
per inch, facilitating precise adjustment and rendering capabilities. Access 
essential image metadata effortlessly, empowering streamlined image processing 
workflows for enhanced user experiences.

```csharp
public override double HorizontalResolution { get; set; }

Property Value

double

Examples

The following example shows how to set horizontal/vertical resolution of a TIFF image.```csharp [C#]

                                                                                             string dir = "c:\\temp\\";

                                                                                             using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                             {
                                                                                                 Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                 // Get horizontal and vertical resolution of the TiffImage.
                                                                                                 double horizontalResolution = tiffImage.HorizontalResolution;
                                                                                                 double verticalResolution = tiffImage.VerticalResolution;
                                                                                                 System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                 System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                 if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                 {
                                                                                                     // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                     System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                     tiffImage.SetResolution(96.0, 96.0);

                                                                                                     System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", tiffImage.HorizontalResolution);
                                                                                                     System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", tiffImage.VerticalResolution);
                                                                                                 }
                                                                                             }

#### Remarks

Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_PageCount"></a> PageCount

Retrieve the total count of pages within the specified document, facilitating 
efficient navigation and management of multi-page content. Incorporate this 
functionality to enhance user experience, enabling seamless access to 
comprehensive document structures.

```csharp
public override int PageCount { get; }

Property Value

int

Pages

Access the pages of the document seamlessly, enabling dynamic navigation and manipulation within the content structure. Empower your application with efficient access to individual pages, facilitating streamlined document processing and enhanced user interaction.

public override Image[] Pages { get; }

Property Value

Image[]

PremultiplyComponents

Indicate if components necessitate premultiplication, ensuring efficient handling of visual elements. Enhance rendering processes by toggling this property, streamlining graphic workflows for optimized performance.

public override bool PremultiplyComponents { get; set; }

Property Value

bool

Examples

The following example creates a new TIFF image, saves the specified semi-transparent pixels, then loads those pixels and gets final colors in the premultiplied form.```csharp [C#]

                                                                                                                                                                            int imageWidth = 3;
                                                                                                                                                                            int imageHeight = 2;

                                                                                                                                                                            Aspose.Imaging.Color[] colors = new Aspose.Imaging.Color[]
                                                                                                                                                                            {
                                                                                                                                                                                Aspose.Imaging.Color.FromArgb(127, 255, 0, 0),
                                                                                                                                                                                Aspose.Imaging.Color.FromArgb(127, 0, 255, 0),
                                                                                                                                                                                Aspose.Imaging.Color.FromArgb(127, 0, 0, 255),
                                                                                                                                                                                Aspose.Imaging.Color.FromArgb(127, 255, 255, 0),
                                                                                                                                                                                Aspose.Imaging.Color.FromArgb(127, 255, 0, 255),
                                                                                                                                                                                Aspose.Imaging.Color.FromArgb(127, 0, 255, 255),
                                                                                                                                                                            };

                                                                                                                                                                            Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffDeflateRgba);
                                                                                                                                                                            createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);

                                                                                                                                                                            using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Create(createOptions, imageWidth, imageHeight))
                                                                                                                                                                            {
                                                                                                                                                                                // Save pixels for the whole image.
                                                                                                                                                                                image.SavePixels(image.Bounds, colors);

                                                                                                                                                                                // The pixels are stored in the original image in the non-premultiplied form.
                                                                                                                                                                                // Need to specify the corresponding option explicitly to obtain premultiplied color components.
                                                                                                                                                                                // The premultiplied color components are calculated by the formulas:
                                                                                                                                                                                // red = original_red * alpha / 255;
                                                                                                                                                                                // green = original_green * alpha / 255;
                                                                                                                                                                                // blue = original_blue * alpha / 255;
                                                                                                                                                                                image.PremultiplyComponents = true;
                                                                                                                                                                                Aspose.Imaging.Color[] premultipliedColors = image.LoadPixels(image.Bounds);

                                                                                                                                                                                for (int i = 0; i &lt; colors.Length; i++)
                                                                                                                                                                                {
                                                                                                                                                                                    System.Console.WriteLine("Original color: {0}", colors[i].ToString());
                                                                                                                                                                                    System.Console.WriteLine("Premultiplied color: {0}", premultipliedColors[i].ToString());
                                                                                                                                                                                }
                                                                                                                                                                            }

                                                                                                                                                                            //The output will look like this:
                                                                                                                                                                            //Original color: Color [A=127, R=255, G=0, B=0]
                                                                                                                                                                            //Premultiplied color: Color [A=127, R=127, G=0, B=0]
                                                                                                                                                                            //Original color: Color [A=127, R=0, G=255, B=0]
                                                                                                                                                                            //Premultiplied color: Color [A=127, R=0, G=127, B=0]
                                                                                                                                                                            //Original color: Color [A=127, R=0, G=0, B=255]
                                                                                                                                                                            //Premultiplied color: Color [A=127, R=0, G=0, B=127]
                                                                                                                                                                            //Original color: Color [A=127, R=255, G=255, B=0]
                                                                                                                                                                            //Premultiplied color: Color [A=127, R=127, G=127, B=0]
                                                                                                                                                                            //Original color: Color [A=127, R=255, G=0, B=255]
                                                                                                                                                                            //Premultiplied color: Color [A=127, R=127, G=0, B=127]
                                                                                                                                                                            //Original color: Color [A=127, R=0, G=255, B=255]
                                                                                                                                                                            //Premultiplied color: Color [A=127, R=0, G=127, B=127]

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_VerticalResolution"></a> VerticalResolution

Access the vertical resolution of the designated Aspose.Imaging.Image in pixels per 
inch, enabling precise adjustments and rendering optimizations. Utilize essential 
image data effortlessly to streamline image processing workflows, ensuring 
superior quality and performance in your applications.

```csharp
public override double VerticalResolution { get; set; }

Property Value

double

Examples

The following example shows how to set horizontal/vertical resolution of a TIFF image.```csharp [C#]

                                                                                             string dir = "c:\\temp\\";

                                                                                             using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                             {
                                                                                                 Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                 // Get horizontal and vertical resolution of the TiffImage.
                                                                                                 double horizontalResolution = tiffImage.HorizontalResolution;
                                                                                                 double verticalResolution = tiffImage.VerticalResolution;
                                                                                                 System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                 System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                 if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                 {
                                                                                                     // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                     System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                     tiffImage.SetResolution(96.0, 96.0);

                                                                                                     System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", tiffImage.HorizontalResolution);
                                                                                                     System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", tiffImage.VerticalResolution);
                                                                                                 }
                                                                                             }

#### Remarks

Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

## Methods

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Add_Aspose_Imaging_FileFormats_Tiff_TiffImage_"></a> Add\(TiffImage\)

Add the frames from the specified image seamlessly into the current frame, 
consolidating their content and enhancing compositional flexibility. Integrate 
this method to streamline frame management and manipulation within your 
application, facilitating efficient handling of multi-frame images.

```csharp
public void Add(TiffImage image)

Parameters

image TiffImage

The source image.

AddFrame(TiffFrame)

Incorporate the specified frame seamlessly into the image, expanding its content and versatility. Utilize this method to enhance image composition and management, empowering efficient handling of multi-frame images within your application.

public void AddFrame(TiffFrame frame)

Parameters

frame TiffFrame

The frame to add.

Examples

The following example shows how to compose a mutlipage TIFF from individual raster images.```csharp [C#]

                                                                                                 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))
                                                                                                 {
                                                                                                     // This is Font and Brush for drawing text on individual frames.
                                                                                                     Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
                                                                                                     Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);

                                                                                                     // Create 5 frames
                                                                                                     for (int i = 1; i &lt;= 5; i++)
                                                                                                     {
                                                                                                         Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                         createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());

                                                                                                         // Create a PNG image and draw the number of page on it.
                                                                                                         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);

                                                                                                         // Create a frame based on the PNG image.
                                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);

                                                                                                         // Add the frame to the TIFF image.
                                                                                                         tiffImage.AddFrame(frame);
                                                                                                     }

                                                                                                     // The image was created with a single default frame. Let's remove it.
                                                                                                     Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
                                                                                                     tiffImage.ActiveFrame = tiffImage.Frames[1];
                                                                                                     tiffImage.RemoveFrame(0);

                                                                                                     // Don't forget to dispose the frame if you won't add it to some other TiffImage
                                                                                                     activeFrame.Dispose();

                                                                                                     tiffImage.Save();
                                                                                                 }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_AddFrames_Aspose_Imaging_FileFormats_Tiff_TiffFrame___"></a> AddFrames\(TiffFrame\[\]\)

Integrate the array of frames seamlessly into the image, enriching its content and 
versatility. Utilize this method to enhance image composition and management, 
enabling efficient handling of multi-frame images within your application.

```csharp
public void AddFrames(TiffFrame[] frames)

Parameters

frames TiffFrame[]

The frames array to add

AddPage(RasterImage)

Incorporate a new page into the existing image seamlessly, expanding its content and versatility. Utilize this method to enhance document composition and management, empowering efficient handling of multi-page images within your application.

public virtual void AddPage(RasterImage page)

Parameters

page RasterImage

The page to add.

Exceptions

ArgumentNullException

page is null.

AdjustBrightness(int)

Implement brightness adjustment for the image, allowing the modification of overall luminance levels. Incorporate this method into your image processing workflow to enhance visibility and improve the visual quality of images within your application.

public override void AdjustBrightness(int brightness)

Parameters

brightness int

Brightness value.

Examples

The following example performs brightness correction of a TIFF image.```csharp [C#]

                                                                            string dir = "c:\\temp\\";

                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                            {
                                                                                Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                // Set the brightness value. The accepted values of brightness are in the range [-255, 255].
                                                                                tiffImage.AdjustBrightness(50);
                                                                                tiffImage.Save(dir + "sample.AdjustBrightness.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                            }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_AdjustContrast_System_Single_"></a> AdjustContrast\(float\)

Enhance the contrast of the Aspose.Imaging.Image instance, 
amplifying the differences between its light and dark areas. Integrate this 
functionality to improve the visual clarity and overall quality of the image 
within your application.

```csharp
public override void AdjustContrast(float contrast)

Parameters

contrast float

Contrast value (in range [-100; 100])

Examples

The following example performs contrast correction of a TIFF image.```csharp [C#]

                                                                          string dir = "c:\\temp\\";

                                                                          using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                          {
                                                                              Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                              // Set the contrast value. The accepted values of contrast are in the range [-100f, 100f].
                                                                              tiffImage.AdjustContrast(50f);
                                                                              tiffImage.Save(dir + "sample.AdjustContrast.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                          }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_AdjustGamma_System_Single_"></a> AdjustGamma\(float\)

Apply gamma correction to the image, adjusting pixel intensities to achieve 
desired color balance. Incorporate this method into your image processing 
workflow to enhance visual quality and improve the accuracy of subsequent 
analysis or display tasks within your application.

```csharp
public override void AdjustGamma(float gamma)

Parameters

gamma float

Gamma for red, green and blue channels coefficient

Examples

The following example performs gamma-correction of a TIFF image.```csharp [C#]

                                                                       string dir = "c:\\temp\\";

                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                       {
                                                                           Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                           // Set gamma coefficient for red, green and blue channels.
                                                                           tiffImage.AdjustGamma(2.5f);
                                                                           tiffImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                       }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_AdjustGamma_System_Single_System_Single_System_Single_"></a> AdjustGamma\(float, float, float\)

Perform gamma correction on the image using individual coefficients for red, 
green, and blue channels, allowing for fine-tuned adjustments of color balance 
and contrast. Integrate this method into your image processing pipeline to 
achieve precise control over color rendering and enhance visual fidelity within 
your application.

```csharp
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)

Parameters

gammaRed float

Gamma for red channel coefficient

gammaGreen float

Gamma for green channel coefficient

gammaBlue float

Gamma for blue channel coefficient

Examples

The following example performs gamma-correction of a TIFF image applying different coefficients for color components.```csharp [C#]

                                                                                                                            string dir = "c:\\temp\\";

                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                            {
                                                                                                                                Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                                // Set individual gamma coefficients for red, green and blue channels.
                                                                                                                                tiffImage.AdjustGamma(1.5f, 2.5f, 3.5f);
                                                                                                                                tiffImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                            }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_AlignResolutions"></a> AlignResolutions\(\)

Implement the AlignResolutions helper method to synchronize horizontal and 
vertical resolutions, ensuring uniformity in image dimensions. This functionality 
facilitates streamlined image processing workflows by harmonizing resolution 
parameters, optimizing visual quality and consistency across various platforms and 
devices.

```csharp
public void AlignResolutions()

BinarizeBradley(double, int)

Implement binarization on the image employing Bradley’s adaptive thresholding algorithm with integral image thresholding. This approach dynamically computes local thresholds based on the image’s neighborhood, enhancing adaptability to varying lighting conditions and ensuring robust segmentation for subsequent processing tasks within your application.

public override void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.

windowSize int

The size of s x s window of pixels centered around this pixel

Examples

The following example binarizes a TIFF image with Bradley’s adaptive thresholding algorithm with the specified window size. Binarized images contain only 2 colors - black and white.```csharp [C#]

                                                                                                                                                                                            string dir = "c:\\temp\\";

                                                                                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                                            {
                                                                                                                                                                                                Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                                                                                                // Binarize the image with a brightness difference of 5. The brightness is a difference between a pixel and the average of an 10 x 10 window of pixels centered around this pixel.
                                                                                                                                                                                                tiffImage.BinarizeBradley(5, 10);
                                                                                                                                                                                                tiffImage.Save(dir + "sample.BinarizeBradley5_10x10.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                                            }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_BinarizeFixed_System_Byte_"></a> BinarizeFixed\(byte\)

Apply binarization to the image using a predefined threshold, converting it into 
a binary image with distinct foreground and background regions. Incorporate this 
method into your image processing workflow to facilitate segmentation and feature 
extraction tasks, enhancing the accuracy and efficiency of image analysis within 
your application.

```csharp
public override void BinarizeFixed(byte threshold)

Parameters

threshold byte

Threshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise.

Examples

The following example binarizes a TIFF image with the predefined threshold. Binarized images contain only 2 colors - black and white.```csharp [C#]

                                                                                                                                            string dir = "c:\\temp\\";

                                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                            {
                                                                                                                                                Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                                                // Binarize the image with a threshold value of 127.
                                                                                                                                                // If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
                                                                                                                                                tiffImage.BinarizeFixed(127);
                                                                                                                                                tiffImage.Save(dir + "sample.BinarizeFixed.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                            }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_BinarizeOtsu"></a> BinarizeOtsu\(\)

Utilize Otsu thresholding to perform binarization on the image, automatically 
determining the optimal threshold value based on the image's histogram. Integrate 
this method into your image processing workflow to achieve effective segmentation 
and feature extraction, enhancing the accuracy and reliability of image analysis 
tasks within your application.

```csharp
public override void BinarizeOtsu()

Examples

The following example binarizes a TIFF image with Otsu thresholding. Binarized images contain only 2 colors - black and white.```csharp [C#]

                                                                                                                                     string dir = "c:\\temp\\";

                                                                                                                                     using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                     {
                                                                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                                         // Binarize the image with Otsu thresholding.
                                                                                                                                         tiffImage.BinarizeOtsu();
                                                                                                                                         tiffImage.Save(dir + "sample.BinarizeOtsu.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                     }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Crop_Aspose_Imaging_Rectangle_"></a> Crop\(Rectangle\)

Crop the image using a specified rectangular region, allowing precise selection of 
desired content. Integrate this method into your image processing workflow to 
efficiently remove unwanted areas and focus on essential details, enhancing the 
overall clarity and composition of the image.

```csharp
public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

The rectangle.

Examples

The following example crops a TIFF image. The cropping area is be specified via Aspose.Imaging.Rectangle.```csharp [C#]

                                                                                                                string dir = "c:\\temp\\";

                                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                {
                                                                                                                    Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                    // Crop the image. The cropping area is the rectangular central area of the image.
                                                                                                                    Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(tiffImage.Width / 4, tiffImage.Height / 4, tiffImage.Width / 2, tiffImage.Height / 2);
                                                                                                                    tiffImage.Crop(area);

                                                                                                                    // Save the cropped image to PNG
                                                                                                                    tiffImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Crop_System_Int32_System_Int32_System_Int32_System_Int32_"></a> Crop\(int, int, int, int\)

Perform cropping on the image by specifying shifts in the left, right, top, and 
bottom directions. This method enables precise selection of the desired portion of 
the image, facilitating efficient removal of unwanted areas and focusing on 
essential content. Integrate this functionality into your image processing 
pipeline to enhance clarity and composition as needed within your application.

```csharp
public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)

Parameters

leftShift int

The left shift.

rightShift int

The right shift.

topShift int

The top shift.

bottomShift int

The bottom shift.

Examples

The following example crops a TIFF image. The cropping area is specified via Left, Top, Right, Bottom margins.```csharp [C#]

                                                                                                                     string dir = @"c:\temp\";

                                                                                                                     using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                     {
                                                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                         // Crop again. Set a margin of 10% of the image size.
                                                                                                                         int horizontalMargin = tiffImage.Width / 10;
                                                                                                                         int verticalMargin = tiffImage.Height / 10;
                                                                                                                         tiffImage.Crop(horizontalMargin, horizontalMargin, verticalMargin, verticalMargin);

                                                                                                                         // Save the cropped image to PNG.
                                                                                                                         tiffImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                     }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Dither_Aspose_Imaging_DitheringMethod_System_Int32_Aspose_Imaging_IColorPalette_"></a> Dither\(DitheringMethod, int, IColorPalette\)

Execute dithering on the current image to enhance its visual quality and reduce 
color banding artifacts. Integrate this method into your image processing workflow 
to ensure smoother transitions between colors, resulting in improved overall image 
appearance and clarity.

```csharp
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)

Parameters

ditheringMethod DitheringMethod

The dithering method.

bitsCount int

The final bits count for dithering.

customPalette IColorPalette

The custom palette for dithering.

Examples

The following example loads a TIFF image and performs threshold and floyd dithering using different palette depth.```csharp [C#]

                                                                                                                         string dir = "c:\\temp\\";

                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                         {
                                                                                                                             Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                             // Perform threshold dithering using 4-bit color palette which contains 16 colors.
                                                                                                                             // The more bits specified the higher quality and the bigger size of the output image.
                                                                                                                             // Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
                                                                                                                             tiffImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4, null);

                                                                                                                             tiffImage.Save(dir + "sample.ThresholdDithering4.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                         }

                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                         {
                                                                                                                             Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                             // Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white.
                                                                                                                             // The more bits specified the higher quality and the bigger size of the output image.
                                                                                                                             // Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
                                                                                                                             tiffImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1, null);

                                                                                                                             tiffImage.Save(dir + "sample.FloydSteinbergDithering1.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                         }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Filter_Aspose_Imaging_Rectangle_Aspose_Imaging_ImageFilters_FilterOptions_FilterOptionsBase_"></a> Filter\(Rectangle, FilterOptionsBase\)

Filter the content within the specified rectangle, applying a designated image 
processing filter to enhance or modify the selected region. Integrate this method 
into your image manipulation workflow to achieve targeted enhancements or 
transformations within your application.

```csharp
public override void Filter(Rectangle rectangle, FilterOptionsBase options)

Parameters

rectangle Rectangle

The rectangle.

options FilterOptionsBase

The options.

Examples

The following example applies various types of filters to a TIFF image.```csharp [C#]

                                                                              string dir = "c:\\temp\\";

                                                                              using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                              {
                                                                                  Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                  // Apply a median filter with a rectangle size of 5 to the entire image.
                                                                                  tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
                                                                                  tiffImage.Save(dir + "sample.MedianFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                              }

                                                                              using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                              {
                                                                                  Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                  // Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
                                                                                  tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
                                                                                  tiffImage.Save(dir + "sample.BilateralSmoothingFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                              }

                                                                              using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                              {
                                                                                  Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                  // Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
                                                                                  tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
                                                                                  tiffImage.Save(dir + "sample.GaussianBlurFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                              }

                                                                              using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                              {
                                                                                  Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                  // Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
                                                                                  tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
                                                                                  tiffImage.Save(dir + "sample.GaussWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                              }

                                                                              using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                              {
                                                                                  Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                  // Apply a motion wiener filter with a length of 5, a smooth value of 4.0 and an angle of 90.0 degrees to the entire image.
                                                                                  tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
                                                                                  tiffImage.Save(dir + "sample.MotionWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                              }

                                                                              using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                              {
                                                                                  Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                  // Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
                                                                                  tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
                                                                                  tiffImage.Save(dir + "sample.SharpenFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                              }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_GetOriginalOptions"></a> GetOriginalOptions\(\)

Retrieve options derived from the original file settings, facilitating seamless 
preservation of key parameters such as bit-depth and other essential attributes of 
the original image. Utilize this method to maintain fidelity and consistency in 
image processing tasks, ensuring optimal results without unnecessary alterations.
For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the
Aspose.Imaging.DataStreamSupporter.Save(System.String) method, the output PNG image with 8-bit per pixel will be produced.
To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them
to the Aspose.Imaging.Image.Save(System.String,Aspose.Imaging.ImageOptionsBase) method as the second parameter.

```csharp
public override ImageOptionsBase GetOriginalOptions()

Returns

ImageOptionsBase

The options based on the original file settings.

Exceptions

TiffImageException

There is no original options that can be extracted from image

Grayscale()

Convert the image to its grayscale representation, transforming it into a single-channel image where each pixel represents intensity. Integrate this method into your image processing pipeline to simplify analysis and enhance compatibility with grayscale-based algorithms, facilitating various computer vision and image analysis tasks within your application.

public override void Grayscale()

Examples

The following example transforms a colored TIFF image to its grayscale representation. Grayscale images are composed exclusively of shades of gray and carry only intensity information.```csharp [C#]

                                                                                                                                                                                               string dir = "c:\\temp\\";

                                                                                                                                                                                               using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                                               {
                                                                                                                                                                                                   Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                                                                                                                   tiffImage.Grayscale();
                                                                                                                                                                                                   tiffImage.Save(dir + "sample.Grayscale.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                                               }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_InsertFrame_System_Int32_Aspose_Imaging_FileFormats_Tiff_TiffFrame_"></a> InsertFrame\(int, TiffFrame\)

Insert the new frame at the specified index within the frame sequence, ensuring 
precise control over frame arrangement. Employ this method to manage frame 
sequences effectively, facilitating dynamic manipulation and organization of image 
content within your application.

```csharp
public void InsertFrame(int index, TiffFrame frameToInsert)

Parameters

index int

Index of new frame in list of frames

frameToInsert TiffFrame

The frame To Insert.

NormalizeAngle(bool, Color)

Utilize the NormalizeAngle method specifically designed for scanned text documents to rectify skewed scans, ensuring accurate alignment. Seamlessly integrate this functionality into your text processing workflows to enhance document readability and quality, improving overall efficiency in text recognition and analysis tasks. This method uses Aspose.Imaging.RasterImage.GetSkewAngle and Aspose.Imaging.FileFormats.Tiff.TiffImage.Rotate(System.Single,System.Boolean,Aspose.Imaging.Color) methods.

public override void NormalizeAngle(bool resizeProportionally, Color backgroundColor)

Parameters

resizeProportionally bool

if set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated.

backgroundColor Color

Color of the background.

ReleaseManagedResources()

Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.

protected override void ReleaseManagedResources()

RemoveFrame(int)

Effortlessly eliminate the frame identified by its index from the image sequence, streamlining frame management within your application. Integrate this functionality to enhance efficiency and precision in frame manipulation, facilitating seamless organization and presentation of image content.

public TiffFrame RemoveFrame(int index)

Parameters

index int

Index of frame to be removed.

Returns

TiffFrame

The removed frame.

Examples

The following example shows how to compose a mutlipage TIFF from individual raster images.```csharp [C#]

                                                                                                 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))
                                                                                                 {
                                                                                                     // This is Font and Brush for drawing text on individual frames.
                                                                                                     Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
                                                                                                     Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);

                                                                                                     // Create 5 frames
                                                                                                     for (int i = 1; i &lt;= 5; i++)
                                                                                                     {
                                                                                                         Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                         createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());

                                                                                                         // Create a PNG image and draw the number of page on it.
                                                                                                         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);

                                                                                                         // Create a frame based on the PNG image.
                                                                                                         Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);

                                                                                                         // Add the frame to the TIFF image.
                                                                                                         tiffImage.AddFrame(frame);
                                                                                                     }

                                                                                                     // The image was created with a single default frame. Let's remove it.
                                                                                                     Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
                                                                                                     tiffImage.ActiveFrame = tiffImage.Frames[1];
                                                                                                     tiffImage.RemoveFrame(0);

                                                                                                     // Don't forget to dispose the frame if you won't add it to some other TiffImage
                                                                                                     activeFrame.Dispose();

                                                                                                     tiffImage.Save();
                                                                                                 }

#### Remarks

Note: do not forget to Dispose the frame if you will not add it to some other TiffImage.

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_RemoveFrame_Aspose_Imaging_FileFormats_Tiff_TiffFrame_"></a> RemoveFrame\(TiffFrame\)

Efficiently remove the specified frame from the image sequence, facilitating 
streamlined frame management within your application. Integrate this functionality 
to enhance precision and flexibility in frame manipulation, ensuring seamless 
organization and presentation of image content.

```csharp
public void RemoveFrame(TiffFrame frame)

Parameters

frame TiffFrame

The frame to remove.

Remarks

Note: do not forget to Dispose the frame if you will not add it to some other TiffImage.

RemoveMetadata()

Removes this image instance metadata by setting this Aspose.Imaging.Xmp.IHasXmpData.XmpData and Aspose.Imaging.Exif.IHasExifData.ExifData values to null.

public override void RemoveMetadata()

ReplaceFrame(int, TiffFrame)

Substitute the frame at the designated position with another frame seamlessly, facilitating dynamic frame management within the image sequence. Integrate this method to enhance flexibility and precision in frame manipulation, ensuring optimal organization and presentation of image content within your application.

public TiffFrame ReplaceFrame(int index, TiffFrame frameToReplace)

Parameters

index int

The zero based frame position.

frameToReplace TiffFrame

The frame to replace.

Returns

TiffFrame

The removed frame.

Remarks

Note: do not forget to Dispose the frame if you will not add it to some other TiffImage.

Resize(int, int, ResizeType)

Resize the image according to a specified resizing type, facilitating flexible adjustment of image dimensions while preserving aspect ratio or applying specific scaling algorithms. Incorporate this method into your image processing workflow to achieve precise control over resizing operations within your application.

public override void Resize(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

The new width.

newHeight int

The new height.

resizeType ResizeType

The resize type.

Examples

This example loads a TIFF image and resizes it using various resizing methods.```csharp [C#]

                                                                                     string dir = "c:\\temp\\";

                                                                                     using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                     {
                                                                                         // Scale up by 2 times using Nearest Neighbour resampling.
                                                                                         image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                         // Save to PNG with default options.
                                                                                         image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                     }

                                                                                     using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                     {
                                                                                         // Scale down by 2 times using Nearest Neighbour resampling.
                                                                                         image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                         // Save to PNG with default options.
                                                                                         image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                     }

                                                                                     using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                     {
                                                                                         // Scale up by 2 times using Bilinear resampling.
                                                                                         image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                         // Save to PNG with default options.
                                                                                         image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                     }

                                                                                     using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                     {
                                                                                         // Scale down by 2 times using Bilinear resampling.
                                                                                         image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                         // Save to PNG with default options.
                                                                                         image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                     }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Resize_System_Int32_System_Int32_Aspose_Imaging_ImageResizeSettings_"></a> Resize\(int, int, ImageResizeSettings\)

Adjust the size of the image based on specified settings, allowing for precise 
control over dimensions, aspect ratio, and scaling behavior. Integrate this 
method into your image processing workflow to achieve customized resizing 
operations tailored to the specific requirements of your application.

```csharp
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)

Parameters

newWidth int

The new width.

newHeight int

The new height.

settings ImageResizeSettings

The resize settings.

Examples

This example loads a TIFF image and resizes it using various resizing settings.```csharp [C#]

                                                                                      string dir = "c:\\temp\\";

                                                                                      Aspose.Imaging.ImageResizeSettings resizeSettings = new Aspose.Imaging.ImageResizeSettings();

                                                                                      // The adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation.
                                                                                      resizeSettings.Mode = Aspose.Imaging.ResizeType.AdaptiveResample;

                                                                                      // The small rectangular filter
                                                                                      resizeSettings.FilterType = Aspose.Imaging.ImageFilterType.SmallRectangular;

                                                                                      // The number of colors in the palette.
                                                                                      resizeSettings.EntriesCount = 256;

                                                                                      // The color quantization is not used
                                                                                      resizeSettings.ColorQuantizationMethod = ColorQuantizationMethod.None;

                                                                                      // The euclidian method
                                                                                      resizeSettings.ColorCompareMethod = ColorCompareMethod.Euclidian;

                                                                                      using (Aspose.Imaging.Image image = (Aspose.Imaging.Image)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                      {
                                                                                          Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                          // Scale down by 2 times using adaptive resampling.
                                                                                          tiffImage.Resize(image.Width / 2, image.Height / 2, resizeSettings);

                                                                                          // Save to PNG
                                                                                          tiffImage.Save(dir + "downsample.adaptive.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                      }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_ResizeHeightProportionally_System_Int32_Aspose_Imaging_ResizeType_"></a> ResizeHeightProportionally\(int, ResizeType\)

Conduct a proportional adjustment of the image's height, preserving its aspect 
ratio for consistent visual integrity. Employ this method to dynamically resize 
images within your application, ensuring optimal display across diverse platforms 
and devices without compromising content quality.

```csharp
public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)

Parameters

newHeight int

The new height.

resizeType ResizeType

Type of the resize.

Examples

This example loads a TIFF image and resizes it proportionally using various resizing methods. Only the height is specified, the width is calculated automatically.```csharp [C#]

                                                                                                                                                                         string dir = "c:\\temp\\";

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale up by 2 times using Nearest Neighbour resampling.
                                                                                                                                                                             image.ResizeHeightProportionally(image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale down by 2 times using Nearest Neighbour resampling.
                                                                                                                                                                             image.ResizeHeightProportionally(image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale up by 2 times using Bilinear resampling.
                                                                                                                                                                             image.ResizeHeightProportionally(image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale down by 2 times using Bilinear resampling.
                                                                                                                                                                             image.ResizeHeightProportionally(image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_ResizeProportional_System_Int32_System_Int32_Aspose_Imaging_ResizeType_"></a> ResizeProportional\(int, int, ResizeType\)

Conduct a proportional resize operation on the image, preserving its aspect ratio 
while adjusting its dimensions. Employ this method to dynamically scale images 
within your application, ensuring consistent visual representation of content 
integrity.
The proportional resize will resize each frame according to the ratio of <code class="paramref">newWidth</code>/width and <code class="paramref">newHeight</code>/height.

```csharp
public void ResizeProportional(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

The new width.

newHeight int

The new height.

resizeType ResizeType

The resize type.

ResizeWidthProportionally(int, ResizeType)

Adjust the width of the image while maintaining its aspect ratio, ensuring proportional resizing for optimal visual presentation. Utilize this method to dynamically scale images within your application, facilitating consistent and aesthetically pleasing rendering across various display contexts.

public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)

Parameters

newWidth int

The new width.

resizeType ResizeType

Type of the resize.

Examples

This example loads a TIFF image and resizes it proportionally using various resizing methods. Only the width is specified, the height is calculated automatically.```csharp [C#]

                                                                                                                                                                         string dir = "c:\\temp\\";

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale up by 2 times using Nearest Neighbour resampling.
                                                                                                                                                                             image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale down by 2 times using Nearest Neighbour resampling.
                                                                                                                                                                             image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale up by 2 times using Bilinear resampling.
                                                                                                                                                                             image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

                                                                                                                                                                         using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                                                         {
                                                                                                                                                                             // Scale down by 2 times using Bilinear resampling.
                                                                                                                                                                             image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                                                                                                             // Save to PNG with the default options.
                                                                                                                                                                             image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                                                         }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_Rotate_System_Single_System_Boolean_Aspose_Imaging_Color_"></a> Rotate\(float, bool, Color\)

Rotate the image around its center point by a specified angle, enabling precise 
orientation adjustments. Incorporate this functionality into your image processing 
pipeline to facilitate accurate transformations, ensuring optimal alignment and 
presentation of visual content within your application.

```csharp
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)

Parameters

angle float

The rotate angle in degrees. Positive values will rotate clockwise.

resizeProportionally bool

if set to true you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated.

backgroundColor Color

Color of the background.

Examples

The following example shows how to rotate a TIFF image around the center by 45 degrees clockwise.```csharp [C#]

                                                                                                        string dir = "c:\\temp\\";
                                                                                                        Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                        // Create a permanent, not temporary file source.
                                                                                                        createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "rotated.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))
                                                                                                        {
                                                                                                            // The linear gradient from the left-top to the right-bottom corner of the image.
                                                                                                            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);

                                                                                                            // Fill the active frame with the linear gradient brush.
                                                                                                            Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage);
                                                                                                            gr.FillRectangle(brush, tiffImage.Bounds);

                                                                                                            // Rotate the image around the center by 45 degrees clockwise. 
                                                                                                            // The image size changed according to rotated rectangle (corner points).
                                                                                                            tiffImage.Rotate(45f, true, Aspose.Imaging.Color.Black);
                                                                                                            tiffImage.Save();

                                                                                                            // Rotate the image around the center by 45 degrees clockwise.
                                                                                                            // Leave the image dimensions untouched and only the internal image content are rotated.
                                                                                                            tiffImage.Rotate(45f, false, Aspose.Imaging.Color.Gray);
                                                                                                            tiffImage.Save(dir + "rotated.preservesize.tif");
                                                                                                        }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_RotateFlip_Aspose_Imaging_RotateFlipType_"></a> RotateFlip\(RotateFlipType\)

Perform rotation, flipping, or a combination of both operations exclusively on the 
active frame. This method allows precise manipulation of individual frames within 
the image sequence, enhancing flexibility in image editing and composition within 
your application.

```csharp
public override void RotateFlip(RotateFlipType rotateFlipType)

Parameters

rotateFlipType RotateFlipType

The rotate flip type.

Examples

This example loads a TIFF image, rotates it by 90 degrees clockwise and optionally flips the image horizontally and(or) vertically.```csharp [C#]

                                                                                                                                          string dir = "c:\\temp\\";

                                                                                                                                          Aspose.Imaging.RotateFlipType[] rotateFlipTypes = new Aspose.Imaging.RotateFlipType[]
                                                                                                                                          {
                                                                                                                                              Aspose.Imaging.RotateFlipType.Rotate90FlipNone,
                                                                                                                                              Aspose.Imaging.RotateFlipType.Rotate90FlipX,
                                                                                                                                              Aspose.Imaging.RotateFlipType.Rotate90FlipXY,
                                                                                                                                              Aspose.Imaging.RotateFlipType.Rotate90FlipY,
                                                                                                                                          };

                                                                                                                                          foreach (Aspose.Imaging.RotateFlipType rotateFlipType in rotateFlipTypes)
                                                                                                                                          {
                                                                                                                                              // Rotate, flip and save to the output file.
                                                                                                                                              using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                                                              {
                                                                                                                                                  image.RotateFlip(rotateFlipType);
                                                                                                                                                  image.Save(dir + "sample." + rotateFlipType + ".png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                                                              }
                                                                                                                                          }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_SaveData_System_IO_Stream_"></a> SaveData\(Stream\)

Saves the object's data to the specified stream.

```csharp
protected override void SaveData(Stream stream)

Parameters

stream Stream

The stream to save the object’s data to.

SetResolution(double, double)

Establishes the resolution for the specified Aspose.Imaging.RasterImage, enabling precise control over image rendering and display properties. Integrate this functionality to optimize visual output and ensure compatibility with diverse output devices and platforms, enhancing the overall user experience.

public override void SetResolution(double dpiX, double dpiY)

Parameters

dpiX double

The horizontal resolution, in dots per inch, of the Aspose.Imaging.RasterImage.

dpiY double

The vertical resolution, in dots per inch, of the Aspose.Imaging.RasterImage.

Examples

The following example shows how to set horizontal/vertical resolution of a TIFF image.```csharp [C#]

                                                                                             string dir = "c:\\temp\\";

                                                                                             using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                             {
                                                                                                 Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                 // Get horizontal and vertical resolution of the TiffImage.
                                                                                                 double horizontalResolution = tiffImage.HorizontalResolution;
                                                                                                 double verticalResolution = tiffImage.VerticalResolution;
                                                                                                 System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                 System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                 if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                 {
                                                                                                     // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                     System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                     tiffImage.SetResolution(96.0, 96.0);

                                                                                                     System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", tiffImage.HorizontalResolution);
                                                                                                     System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", tiffImage.VerticalResolution);
                                                                                                 }
                                                                                             }

### <a id="Aspose_Imaging_FileFormats_Tiff_TiffImage_UpdateDimensions_System_Int32_System_Int32_"></a> UpdateDimensions\(int, int\)

Updates the image dimensions.

```csharp
protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

The new image width.

newHeight int

The new image height.

Exceptions

NotImplementedException