Work with PSB File Format in Aspose.PSD

« Back to News List | By George Wright | 08 Mar 2020
Image of Work with PSB File Format in Aspose.PSD

Aspose.PSD now supports the PSB file format. The PSB (Photoshop Big file) is an Adobe Photoshop Large Document file. Only a few users of Adobe Photoshop know about the existence of the PSB file format but all are familiar with the PSD file format. The PSB format is similar to PSD format except that PSB supports larger files, both in image dimension and overall size.

The PSD file format is limited to 30K x 30K pixels, which is the main file format used by Adobe Photoshop. PSBs, on the other hand, supports documents up to 300K pixels in any dimension, which is plenty even for graphics designers who often need to work with ultra-high resolutions. A PSB file supports layers, effects, filters, and all other features of Adobe Photoshop. It is also possible to save HDR images with the PSB file format.

How to Convert a PSB File
Using Aspose.PSD you can convert existing PSB files directly into PSD, PDF, JPEG and several other formats without any loss of quality. In this article, we will demonstrate how you can convert PSB files to other formats.

Convert PSB to JPEG
You can export an existing PSB file to JPEG using Aspose.PSD. The API has JpegOptions class which allows you to convert PSB to JPEG.

The following code demonstrates the conversion of PSB to JPEG using C#.

// The path to the documents directory.

string dataDir = RunExamples.GetDataDir_PSB();

string[] sourceFileNames = new string[] {

//Test files with layers

"Little",

"Simple",

//Test files without layers

"psb",

"psb3"

};

var options = new PsdLoadOptions();

foreach (var fileName in sourceFileNames)

{

var sourceFileName = dataDir + fileName + ".psb";

using (PsdImage image = (PsdImage)Image.Load(sourceFileName, options))

{

// All jpeg and psd files must be readable

image.Save(dataDir + fileName + "_output.jpg", new JpegOptions() { Quality = 95 });

image.Save(dataDir + fileName + "_output.psb");

}

}

 

Convert PSB to PDF
Converting PSB to PDF is similar to conversion to JPEG as shown above. The API has PdfOptions class that allows you to export PSB file to PDF format.

// The path to the documents directory.

 

string dataDir = RunExamples.GetDataDir_PSB();

 

string sourceFileName = dataDir + "Simple.psb";

 

using (PsdImage image = (PsdImage)Image.Load(sourceFileName))

 

{

 

string outFileName = dataDir + "Simple.pdf";

 

Convert PSB to PSD
Using PsdOptions class you can export existing PSB file to PNG format. The following code snippet demonstrates how to convert PSB to PSD.

// The path to the documents directory.

string dataDir = RunExamples.GetDataDir_PSB();

string sourceFilePathPsb = dataDir + "2layers.psb";

string outputFilePathPsd = dataDir + "ConvertFromPsb.psd";

using (Image img = Image.Load(sourceFilePathPsb))

{

var options = new PsdOptions((PsdImage)img) { FileFormatVersion = FileFormatVersion.Psd };

img.Save(outputFilePathPsd, options);

}

 

 

image.Save(outFileName, new PdfOptions());

 

}