Converting PSD Image To Raster Format using C#
Overview
Aspose.PSD allows converting PSD and PSB formats to JPEG, JPEG2000, PNG, TIFF, PDF, GIF and BMP formats
You can convert PSD files on your server with Aspose.PSD without Photoshop. It’s a good replacement for Adobe Photoshop scripting because the EULA of Adobe forbids using App on a server and change its UI. But with PSD Format SDK you can make a batch convert of PSD Files. Your PSD format export can be pixel-perfect with the Read-Only mode, or you can change layers, texts, effects, and then make export.
Specific examples of Export of PSD to Raster Formats
Exporting PSD image to various raster file formats
Below provided sample code demonstrates how to convert PSD to several raster file formats.
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string srcPath = dataDir + @"sample.psd"; | |
string destName = dataDir + @"export"; | |
// Load an existing PSD image as Image | |
using (Image image = Image.Load(srcPath)) | |
{ | |
// Create an instance of PngOptions class | |
PngOptions pngOptions = new PngOptions(); | |
// Create an instance of BmpOptions class | |
BmpOptions bmpOptions = new BmpOptions(); | |
// Create an instance of TiffOptions class | |
TiffOptions tiffOptions = new TiffOptions(FileFormats.Tiff.Enums.TiffExpectedFormat.Default); | |
// Create an instance of GifOptions class | |
GifOptions gifOptions = new GifOptions(); | |
// Create an instance of JpegOptions class | |
JpegOptions jpegOptions = new JpegOptions(); | |
// Create an instance of Jpeg2000Options class | |
Jpeg2000Options jpeg2000Options = new Jpeg2000Options(); | |
// Call the save method, provide output path and export options to convert PSD file to various raster file formats. | |
image.Save(destName + ".png", pngOptions); | |
image.Save(destName + ".bmp", bmpOptions); | |
image.Save(destName + ".tiff", tiffOptions); | |
image.Save(destName + ".gif", gifOptions); | |
image.Save(destName + ".jpeg", jpegOptions); | |
image.Save(destName + ".jp2", jpeg2000Options); | |
} |