将PSB转换为JPEG
JpegOptions 类,可用于将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);}
还想要更多吗可以点击阅读【2019 · Aspose最新资源整合】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!