Aspose.PSD for .NET 21.12 - 发行说明

关键字 摘要 类别
PSDNET-997 添加通过编程限制字体的功能 功能
PSDNET-785 Aspose.PSD 20.10:无法加载 PSD 文件 错误
PSDNET-812 加载 PSD 文件时出现 ImageLoad 异常 错误
PSDNET-870 加载不支持的 CompressionMethod 的 PSD 图层时出现 ImageLoad 异常 错误
PSDNET-918 Aspose.PSD 21.6:不支持 PSD 文件的压缩方法 错误
PSDNET-984 保存矢量路径与蒙版时不正确 错误
PSDNET-1001 特定文件中 TextPortion 中的字体不正确 错误
PSDNET-1031 加载图像时出现 Compression method is not supported 异常 错误
PSDNET-1033 在特定文件中保存时超出范围 错误
PSDNET-1036 添加 PathStructure 支持以避免加载文件错误 错误

公共 API 更改

已添加的 API:

  • T:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure
  • M:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure.#ctor(Aspose.PSD.FileFormats.Psd.Layers.LayerResources.ClassID)
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure.Key
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure.Prefix
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure.Path
  • P:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure.Length
  • F:Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures.PathStructure.StructureKey
  • M:Aspose.PSD.FontSettings.SetAllowedFonts(System.String[])
  • M:Aspose.PSD.FontSettings.IsFontAllowed(System.String)
  • M:Aspose.PSD.FontSettings.GetReplacementFont(System.String)
  • M:Aspose.PSD.FontSettings.GetFontReplacements(System.String)
  • M:Aspose.PSD.FontSettings.SetFontReplacements(System.String,System.String[])
  • M:Aspose.PSD.FontSettings.ClearFontReplacements

已移除的 API:

使用示例:

PSDNET-785. Aspose.PSD 20.10:无法加载 PSD 文件

            string src = "ShimadzuLetterhead100.psd";
            string output = "output.psd";
            using (var img = (PsdImage)Image.Load(src, new PsdLoadOptions() { ReadOnlyMode = true }))
            {
                img.Save(output);
            }

PSDNET-812. 加载 PSD 文件时出现 ImageLoad 异常

            string src = "5-MX10600_Amazon_DEVICES_2_1000x1000.psd";
            string output = "output.psd";
            using (var img = (PsdImage)Image.Load(src))
            {
                img.Save(output);
            }

PSDNET-870. 加载不支持的 CompressionMethod 的 PSD 图层时出现 ImageLoad 异常

            string srcFile = "sourceFile.psd";
            string output = "output.psd";

            using (PsdImage image = (PsdImage)Image.Load(srcFile))
            {
                image.Save(output);
            }

PSDNET-918. Aspose.PSD 21.6:不支持 PSD 文件的压缩方法

            string srcFile = "Fb-blue-jury (1).psd";
            string output = "output.psd";

            using (PsdImage image = (PsdImage)Image.Load(srcFile))
            {
                image.Save(output);
            }

PSDNET-984. 保存矢量路径与蒙版时不正确

            string srcFile = "PsdConvertToPngExample.psd";
            string outputFilePng = "output.png";

            using (var psdImage = (PsdImage)Image.Load(srcFile, new PsdLoadOptions() { LoadEffectsResource = true }))
            {
                psdImage.Save(
                    outputFilePng,
                    new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha, Progressive = true, CompressionLevel = 9 });
            }

PSDNET-997. 添加通过编程限制字体的功能

            string srcFile = "fonts_com_updated.psd";
            string output = "etalon_fonts_com_updated.psd.png";

            try
            {
                var fontList = new string[] { "Courier New", "Webdings", "Bookman Old Style" };
                FontSettings.SetAllowedFonts(fontList);

                var myriadReplacement = new string[] { "Courier New", "Webdings", "Bookman Old Style" };
                var calibriReplacement = new string[] { "Webdings", "Courier New", "Bookman Old Style" };
                var arialReplacement = new string[] { "Bookman Old Style", "Courier New", "Webdings" };
                var timesReplacement = new string[] { "Arial", "NotExistedFont", "Courier New" };

                FontSettings.SetFontReplacements("MyriadPro-Regular", myriadReplacement);
                FontSettings.SetFontReplacements("Calibri", calibriReplacement);
                FontSettings.SetFontReplacements("Arial", arialReplacement);
                FontSettings.SetFontReplacements("Times New Roman", timesReplacement);

                using (PsdImage image = (PsdImage)Image.Load(srcFile))
                {
                    image.Save(output, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
                }
            } 
            finally
            {
                FontSettings.SetAllowedFonts(null);
                FontSettings.ClearFontReplacements();
            }

PSDNET-1001. 特定文件中 TextPortion 中的字体不正确

            string srcFile = "fonts_com.psd";
            string output = "output.png";

            using (PsdImage image = (PsdImage)Image.Load(srcFile))
            {
                var tl = (TextLayer)image.Layers[1];
                var fontName = tl.TextData.Items[0].Style.FontName;
                if (fontName != "MyriadPro-Regular")
                {
                    throw new Exception("Incorrect font");
                }

                // 应该得到 Myriad Pro,但我们看到的是 AdobeInvisFont
                image.Save(output, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
            }

PSDNET-1031. 加载图像时出现 Compression method is not supported 异常

            string srcFile = "shirt-error.psd";
            string output = "output.psd";

            using (PsdImage image = (PsdImage)Image.Load(srcFile))
            {
                image.Save(output);
            }

PSDNET-1033. 保存时超出范围

            string srcFile = "237708.psd";
            string output = "output.png";

            using (PsdImage image = (PsdImage)Image.Load(srcFile))
            {
                image.Save(output, new PngOptions());
            }

PSDNET-1036. 添加 PathStructure 支持以避免加载文件错误

            string srcFile = "shirt-color.psd";
            string output = "output.psd";

            using (PsdImage image = (PsdImage)Image.Load(srcFile))
            {
                image.Save(output);
            }