使用 C# 将 PSD 转换为 JPG
Contents
[
Hide
]
C# .NET Photoshop Manipulation API - Aspose.PSD 是一种 PSD 格式 SDK,允许您轻松将 Adobe Photoshop 文件 PSD 转换为 JPG 文件。您需要使用以下代码片段来执行此操作:
下面提供的示例代码演示了如何将 PSD 转换为 JPG:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string inputFile = dataDir + "PsdConvertToExample.psd"; | |
using (var psdImage = (PsdImage)Image.Load(inputFile)) | |
{ | |
psdImage.Save(dataDir + "PsdConvertedToJpg.jpg", new JpegOptions() {Quality = 80, JpegLsAllowedLossyError = 10 }); | |
} |
您可以指定 JPEG 文件格式质量、JPEG 允许的有损误差以及 PSD 导出为 JPG 的其他参数。
您可以在编辑 PSD 文件后或以像素完美的方式以只读模式导出 PSD 文件,其中将使用 PSD 文件预览。
这里是导出Photoshop 渐变和PSD 文本图层的示例效果: