Aspose.PSD for .NET是高级PSD文件格式操做API,没有任何Adobe Photoshop依赖项。API容许建立或编辑Photoshop文件,并提供更新图层属性,添加水印,执行图形操做或将一种文件格式转换为另外一种文件的功能。spa
PSB是Adobe公司的Photoshop大型文档文件,大小为30,000 x 30,000像素的文件将以PSD扩展名保存,大于PSD的最大300,000 x 300,000像素的文件将以PSB扩展名保存。PSB文件支持Adobe Photoshop的图层,效果,滤镜和全部其余功能。orm
尽管PSD文件是平常经常使用的Photoshop保存格式,可是在许多PSB运用也十分普遍。使用Aspose.PSD,能够将现有PSB文件直接转换为PSD、PDF、JPEG和其余几种格式,而不会下降质量。在本文中,咱们将演示如何将PSB文件转换为其余格式。文档
同时,很高兴的告诉你们,.NET版Aspose.PSD迎来了v19.12版本更新!支持连接层,支持SoCoResource,修复将PSB保存为PNG被冻结等Bug。(点击下载)get
将PSB转换为JPEGstring
JpegOptions 类,可用于将PSB转换为JPEG。如下代码演示了使用C#将PSB转换为JPEG的过程。it
// 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转换为PDFio
如上所示,将PSB转换为PDF相似于转换为JPEG。该API具备PdfOptions 类,该类容许您将PSB文件导出为PDF格式。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。foreach
// 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),咱们很高兴为您提供查询和咨询。