将 PSD 转换为其他格式

将 PSD 转换为 PDF

Aspose.PSD for .NET 提供了 Image 类来加载 PSD 文件,并可以将图像保存为 PDF 格式。下面提供的示例代码演示了如何将 PSD 转换为 PDF。

// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET
// Add support of PSD export to PDF
string[] sourcesFiles = new string[]
{
@"1.psd",
@"little.psb",
@"psb3.psb",
@"inRgb16.psd",
@"ALotOfElementTypes.psd",
@"ColorOverlayAndShadowAndMask.psd",
@"ThreeRegularLayersSemiTransparent.psd"
};
for (int i = 0; i < sourcesFiles.Length; i++)
{
string sourceFileName = sourcesFiles[i];
using (PsdImage image = (PsdImage)Image.Load(dataDir + sourceFileName))
{
string outFileName = "PsdToPdf" + i + ".pdf";
image.Save(dataDir + outFileName, new PdfOptions());
}
}

带裁剪蒙版的 PSD 转 PDF

裁剪蒙版允许您一次性为多个图层应用蒙版。本文演示了如何将 PSD 导出为 PDF 并附带裁剪蒙版。以下是实现此功能的示例代码。

// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET
using (PsdImage image = (PsdImage)Image.Load(dataDir + "clip.psd"))
{
image.Save(dataDir + "output.pdf", new PdfOptions());
}

带调整图层的 PSD 转 PDF

调整图层可以对图像应用颜色和色调调整,而不会永久更改像素值。本文演示了如何将 PSD 导出为 PDF 并带有调整图层。下面提供了代码片段。

// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET
using (PsdImage image = (PsdImage)Image.Load(dataDir + "example.psd"))
{
image.Save(dataDir + "document.pdf", new PdfOptions());
}

PSD 文件转为 PSB

使用 Aspose.PSD for .NET,开发人员可以将 PSD 转换为 PSB 文件格式。本文展示了如何使用 Aspose.PSD 将 PSD 文件导出/转换为 PSB 格式。Aspose.PSD for .NET 提供了 Image 类公开的 Load 方法来加载 PSD 文件,然后可以用相同的方法保存结果。以下代码片段展示了如何将 PSD 转换为 PSB 文件

// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET
string sourceFilePathPsd = dataDir + "2layers.psd";
string outputFilePathPsb = dataDir + "ConvertFromPsd.psb";
using (Image img = Image.Load(sourceFilePathPsd))
{
var options = new PsdOptions((PsdImage)img) { PsdVersion = PsdVersion.Psb };
img.Save(outputFilePathPsb, options);
}