Manipulating BIGTIFF Images
Contents
[
Hide
]
Load bigtiff image and save to another format
BIGTIFF image can be easily loaded and saved to other supported image formats using Aspose.Imaging. Sample code shows how to process this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Aspose.Imaging; | |
using Aspose.Imaging.FileFormats.Bmp; | |
using Aspose.Imaging.FileFormats.Tiff; | |
using Aspose.Imaging.FileFormats.Tiff.Enums; | |
using Aspose.Imaging.ImageOptions; | |
using Aspose.Imaging.Sources; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
string templatesFolder = @"c:\Users\USER\Downloads\templates\"; | |
string dataDir = templatesFolder; | |
string fileName = Path.Combine(dataDir, "template.tiff"); | |
// Create an instance of TiffOptions and set its various properties | |
TiffOptions options = new TiffOptions(TiffExpectedFormat.Default); | |
options.BitsPerSample = new ushort[] { 8, 8, 8 }; | |
options.Photometric = TiffPhotometrics.Rgb; | |
options.Xresolution = new TiffRational(72); | |
options.Yresolution = new TiffRational(72); | |
options.ResolutionUnit = TiffResolutionUnits.Inch; | |
options.PlanarConfiguration = TiffPlanarConfigs.Contiguous; | |
// Set the Compression to AdobeDeflate | |
options.Compression = TiffCompressions.AdobeDeflate; | |
// Or Deflate | |
// Options.Compression = TiffCompressions.Deflate; | |
// Load an existing image in an instance of RasterImage | |
using (RasterImage image = (RasterImage)Image.Load(dataDir + "template.tiff")) | |
{ | |
// Create a new TiffImage from the RasterImage and Save the resultant image while passing the instance of TiffOptions | |
using (TiffImage tiffImage = new TiffImage(new TiffFrame(image))) | |
{ | |
tiffImage.Save(dataDir + "output.tiff", options); | |
} | |
File.Delete(dataDir + "output.tiff"); | |
} |