将 PSB 文件转换为 JPEG
使用 Aspose.PSD for .NET,开发人员可以将 PSB 文件格式转换为 JPEG 文件格式。本主题解释了加载现有 PSB 文件并将其转换为 JPEG 文件格式的方法。
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
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 文件转换为 PSD
使用 Aspose.PSD for .NET,开发人员可以将 PSB 转换为 PSD 文件格式。本文展示了如何使用 Aspose.PSD 导出/转换 PSB 文件为 PSD 格式。Aspose.PSD for .NET 提供了由 Image 类公开的 Load 方法来加载 PSB 文件,同样可以用来保存结果。以下代码片段显示了如何将 PSB 转换为 PSD 文件。
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFilePathPsb = dataDir + "2layers.psb"; | |
string outputFilePathPsd = dataDir + "ConvertFromPsb.psd"; | |
using (Image img = Image.Load(sourceFilePathPsb)) | |
{ | |
var options = new PsdOptions((PsdImage)img) { PsdVersion = PsdVersion.Psd }; | |
img.Save(outputFilePathPsd, options); | |
} |
使用 Aspose.PSD for .NET,开发人员可以将 PSB 转换为 PDF 文件格式。本文展示了如何使用 Aspose.PSD 导出/转换 PSB 文件为 PDF 格式。Aspose.PSD for .NET 提供了由 Image 类公开的 Load 方法来加载 PSB 文件,同样可以用来保存结果。 PdfOptions 类提供了创建 PDF 的选项,例如 PageSize,JpegQuality 等。可以使用这些选项来获得所需的 PDF 标准。
将 PSB 文件转换为 PDF
以下代码片段显示了如何将 PSB 转换为 PDF 文件
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFileName = dataDir + "Simple.psb"; | |
using (PsdImage image = (PsdImage)Image.Load(sourceFileName)) | |
{ | |
string outFileName = dataDir + "Simple.pdf"; | |
image.Save(outFileName, new PdfOptions()); | |
} |