PSB是Adobe公司的Photoshop大型文档文件,大小为30,000 x 30,000像素的文件将以PSD扩展名保存,大于PSD的最大300,000 x 300,000像素的文件将以PSB扩展名保存。PSB文件支持Adobe Photoshop的图层,效果,滤镜和所有其他功能。
只管PSD文件这天常常用的Photoshop保存格式,但是在许多PSB利用也十分广泛。利用Aspose.PSD,可以将现有PSB文件直接转换为PSD、PDF、JPEG和其他几种格式,而不会降落质量。在本文中,我们将演示如何将PSB文件转换为其他格式。
同时,很高兴的见告大家,.NET版Aspose.PSD迎来了v19.12版本更新!
支持链接层,支持SoCoResource,修复将PSB保存为PNG被冻结等Bug。

(点击文末“理解更多”可下载最新版Aspose.PSD)
将PSB转换为JPEGJpegOptions 类,可用于将PSB转换为JPEG。以下代码演示了利用C#将PSB转换为JPEG的过程。
// 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"); }}将PSB转换为PDF
如上所示,将PSB转换为PDF类似于转换为JPEG。该API具有PdfOptions 类,该类许可您将PSB文件导出为PDF格式。
// 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"; image.Save(outFileName, new PdfOptions());}将PSB转换为PSD
利用PsdOptions 类,可以将现有的PSB文件导出为PNG格式。以下代码段演示了如何将PSB转换为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);}
还想要更多吗?如果您有下载或购买需求,请随时加入Aspose技能互换群(642018183),很高兴为您供应查询和咨询。