Convert CDR to PSD in C#
Contents
[
Hide
]
Using C# Image Processing Library - Aspose.Imaging we can convert single or multipage CDR file to Photoshop PSD file format.
The following code snippet shows you how to convert CDR to Psd.
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 System.IO; | |
string templatesFolder = @"c:\Users\USER\Downloads\templates\"; | |
string dataDir = templatesFolder; | |
using (Aspose.Imaging.FileFormats.Cdr.CdrImage image = (Aspose.Imaging.FileFormats.Cdr.CdrImage)Image.Load(dataDir + "template.cdr")) | |
{ | |
ImageOptionsBase options = new Aspose.Imaging.ImageOptions.PsdOptions(); | |
// By default if image is multipage image all pages exported | |
options.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(); | |
// Optional parameter that indicates to export multipage image as one | |
// layer (page) otherwise it will be exported page to page | |
options.MultiPageOptions.MergeLayers = true; | |
// Set rasterization options for fileformat | |
options.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Color.White, image.Width, image.Height }); | |
options.VectorRasterizationOptions.TextRenderingHint = TextRenderingHint.SingleBitPerPixel; | |
options.VectorRasterizationOptions.SmoothingMode = SmoothingMode.None; | |
image.Save(dataDir + "result.psd", options); | |
} | |
File.Delete(dataDir + "result.psd"); |