Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created February 18, 2021 14:12
Show Gist options
  • Save aspose-com-gists/bede9130e2bdc5959ac7d5c860e5a4ff to your computer and use it in GitHub Desktop.
Save aspose-com-gists/bede9130e2bdc5959ac7d5c860e5a4ff to your computer and use it in GitHub Desktop.
Convert PSB (Photoshop Big) to PDF, JPG, or PSD Programmatically using Java
// Specify input path for PSB file
String sourceFileName = dataDir + "Simple.psb";
// Load input PSB file
PsdLoadOptions options = new PsdLoadOptions();
PsdImage image = (PsdImage)Image.load(sourceFileName, options);
// Initialize JpegOptions class object
JpegOptions jpgoptions = new JpegOptions();
jpgoptions.setQuality(95);
// Convert PSB to JPG file
image.save(dataDir + "Simple_output.jpg",jpgoptions);
// Specify path for input PSB file
String sourceFileName = dataDir + "Simple.psb";
// Load input PSB file
PsdImage image = (PsdImage)Image.load(sourceFileName);
// Convert PSB to PDF file
image.save(dataDir + "Simple_output.pdf",new PdfOptions());
// Specify path for input PSB file
String sourceFileName = dataDir + "2layers.psb";
// Load input PSB file
PsdImage image = (PsdImage)Image.load(sourceFileName);
// Initialize PsdOptions class instance
PsdOptions options = new PsdOptions();
options.setFileFormatVersion(FileFormatVersion.Psd);
// Convert PSB to PSD file
image.save(dataDir + "ConvertFromPsb_out.psd",options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment