Convert cmx to tiff
Contents
[
Hide
]
Using Aspose.Imaging we can convert single paged or multi-page cmx image to single or multi-page tiff.
The following code snippet shows you how to convert cmx to tiff.
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.Tiff.Enums; | |
using Aspose.Imaging.ImageOptions; | |
using System; | |
using System.IO; | |
string templatesFolder = @"c:\Users\USER\Downloads\templates\"; | |
string dataDir = templatesFolder; | |
using (var image = (VectorMultipageImage)Image.Load(dataDir + "template.cmx")) | |
{ | |
VectorRasterizationOptions[] pageOptions = new VectorRasterizationOptions[image.Pages.Length]; | |
for (int i = 0; i < image.Pages.Length; i++) | |
{ | |
CmxRasterizationOptions option = new CmxRasterizationOptions(); | |
option.PageSize = image.Pages[i].Size; | |
pageOptions[i] = option; | |
} | |
// Create TIFF options | |
var options = new TiffOptions(TiffExpectedFormat.TiffDeflateRgb) { MultiPageOptions = new MultiPageOptions { PageRasterizationOptions = pageOptions } }; | |
// Export image to TIFF format | |
image.Save(dataDir + "result.tiff", options); | |
} | |
File.Delete(dataDir + "result.tiff"); |