Aspose.PSD for Python 通过 .NET 的 24.6 版 - 发行说明
Contents
[
Hide
]
本页面包含 Aspose.PSD for Python 通过 .NET 24.6 版 的发行说明
关键字 | 摘要 | 类别 |
---|---|---|
PSDPYTHON-69 | 实现支持渐变映射图层 | 功能 |
PSDPYTHON-70 | [AI 格式] 为 AI 格式添加对 XPacket 元数据的支持 (目前 Python 版本不可用) | 功能 |
PSDPYTHON-71 | 实现膨胀、挤压和扭曲变形类型 | 功能 |
PSDPYTHON-72 | Rgb 和 Lab 模式在包含艺术板图层文件中不能包含少于 3 个通道和多于 4 个通道 | 错误 |
PSDPYTHON-79 | 处理区域顶部必须是正数 (参数 ‘areaToProcess’) 在处理特定文件时 | 错误 |
PSDPYTHON-74 | 保存后,画布图像的展开部分被裁剪。数据丢失,但预览看起来正确 | 错误 |
公共 API 更改
新增 API:
- P:Aspose.PSD.FileFormats.Psd.Layers.FillSettings.NoiseGradientFillSettings.ExpansionCount
- M:Aspose.PSD.FileFormats.Psd.PsdImage.AddGradientMapAdjustmentLayer
- T:Aspose.PSD.FileFormats.Psd.Layers.AdjustmentLayers.GradientMapLayer
- P:Aspose.PSD.FileFormats.Psd.Layers.AdjustmentLayers.GradientMapLayer.GradientSettings
- P:Aspose.PSD.FileFormats.Ai.AiImage.XmpData
删除 API:
- 无
用法示例:
PSDPYTHON-69. 实现支持渐变映射图层
sourceFile = "gradient_map_src.psd"
outputFile = "gradient_map_src_output.psd"
def AssertAreEqual(expected, actual, message=None):
if expected != actual:
raise Exception(message or "对象不相等。")
with PsdImage.load(sourceFile) as image:
im = cast(PsdImage, image)
layer = im.add_gradient_map_adjustment_layer()
layer.gradient_settings.reverse = True
im.save(outputFile)
with PsdImage.load(outputFile) as image:
im = cast(PsdImage, image)
gradient_map_layer = cast(GradientMapLayer, im.layers[1])
gradient_settings = cast(GradientFillSettings, gradient_map_layer.gradient_settings)
AssertAreEqual(0.0, gradient_settings.angle)
AssertAreEqual(4096, gradient_settings.interpolation)
AssertAreEqual(True, gradient_settings.reverse)
AssertAreEqual(False, gradient_settings.align_with_layer)
AssertAreEqual(False, gradient_settings.dither)
AssertAreEqual(GradientType.LINEAR, gradient_settings.gradient_type)
AssertAreEqual(100, gradient_settings.scale)
AssertAreEqual(0.0, gradient_settings.horizontal_offset)
AssertAreEqual(0.0, gradient_settings.vertical_offset)
AssertAreEqual("Custom", gradient_settings.gradient_name)
PSDPYTHON-70. [AI 格式] 为 AI 格式添加对 XPacket 元数据的支持 (目前 Python 版本不可用)
# 目前 Aspose.PSD for Python 不支持此 API
# sourceFile = "ai_one.ai"
#
# def AssertAreEqual(expected, actual):
# if expected != actual:
# raise Exception("对象不相等。")
#
# def AssertIsNotNull(test_object):
# if test_object is None:
# raise Exception("测试对象为 null。")
#
# creator_tool_key = ":CreatorTool"
# n_pages_key = "xmpTPg:NPages"
# unit_key = "stDim:unit"
# height_key = "stDim:h"
# width_key = "stDim:w"
#
# expected_creator_tool = "Adobe Illustrator CC 22.1 (Windows)"
# expected_n_pages = "1"
# expected_unit = "Pixels"
# expected_height = 768
# expected_width = 1366
#
# with AiImage.load(sourceFile) as img:
# image = cast(AiImage, img)
#
# xmp_metadata = image.xmp_data
# # XmpPacketWrapper a
# AssertIsNotNull(xmp_metadata)
#
# basic_package = cast(XmpBasicPackage, xmp_metadata.get_package(Namespaces.XMP_BASIC))
# package = xmp_metadata.packages[4]
#
# creator_tool = basic_package.g[creator_tool_key].to_string()
# n_pages = package[n_pages_key]
# unit = package[unit_key]
# height = np.double.parse(package[height_key].to_string())
# width = np.double.parse(package[width_key].to_string())
#
# AssertAreEqual(creator_tool, expected_creator_tool)
# AssertAreEqual(n_pages, expected_n_pages)
# AssertAreEqual(unit, expected_unit)
# AssertAreEqual(height, expected_height)
# AssertAreEqual(width, expected_width)
PSDPYTHON-71. 实现膨胀、挤压和扭曲类型的变形
files = ["Twist", "Squeeze", "Squeeze_vert", "Inflate"]
for prefix in files:
sourceFile = prefix + ".psd"
outputFile = prefix + "_export.png"
loadOpt = PsdLoadOptions()
loadOpt.allow_warp_repaint = True
loadOpt.load_effects_resource = True
pngOpt = PngOptions()
pngOpt.color_type = PngColorType.TRUECOLOR_WITH_ALPHA
with PsdImage.load(sourceFile, loadOpt) as psdImage:
psdImage.save(outputFile, pngOpt)
PSDPYTHON-72. Rgb 和 Lab 模式在包含艺术板图层文件中不能包含少于 3 个通道和多于 4 个通道
sourceFile = "Rgb5Channels.psb"
outputFile = "Rgb5Channels_output.psd"
with PsdImage.load(sourceFile) as image:
image.save(outputFile)
PSDPYTHON-79. 在处理特定文件的处理区域顶部必须是正数 (参数 ‘areaToProcess’)
sourceFile = "BANNERS_2_Intel-Gamer_psak.psd"
outputFile = "BANNERS_2_Intel-Gamer_psak_out.psd"
psdLoadOptions = PsdLoadOptions()
psdLoadOptions.load_effects_resource = True
psdLoadOptions.allow_warp_repaint = True
with PsdImage.load(sourceFile, psdLoadOptions) as image:
image.save(outputFile)
PSDPYTHON-74. 保存后,画布图像的展开部分被裁剪。数据丢失,但预览看起来正确
sourceFile = "bigfile.psd"
outputFile = "bigfile_output.psd"
outputPicture = "bigfile.png"
loadOptions = PsdLoadOptions()
loadOptions.load_effects_resource = True
loadOptions.use_disk_for_load_effects_resource = True
with PsdImage.load(sourceFile, loadOptions) as image:
psdImage = cast(PsdImage, image)
psdOpt = PsdOptions()
psdOpt.compression_method = CompressionMethod.RLE
psdImage.save(outputFile, psdOpt)