Aspose.PSD for Java 20.6 - 发行说明
Contents
[
Hide
]
本页面包含 Aspose.PSD for Java 20.6 的发行说明
关键 | 摘要 | 类别 |
---|---|---|
PSDJAVA-216 | 支持 LnkEResource(智能对象层资源) | 特性 |
PSDJAVA-219 | 支持 britResource(亮度/对比度调整层资源) | 特性 |
PSDJAVA-222 | 将 DefaultReplacementFont 设置移到 ImageOptionsBase 类 | 增强 |
PSDJAVA-217 | 如果调整层中存在具有空边界的蒙版,则调整 PSD 文件大小不正确 | 错误 |
PSDJAVA-218 | RGB 模式 16 位/通道的 Psd 图像仅在预览时更新图层 | 错误 |
PSDJAVA-220 | 保存 PSD 图层蒙版更改时会被丢弃 | 错误 |
PSDJAVA-221 | 在空图层组中添加图层组后图层顺序不正确 | 错误 |
PSDJAVA-223 | 加载具有复合 LnkE 资源和 adobeStockLicenseState 属性的特定 PSD 文件时出现异常 | 错误 |
PSDJAVA-224 | 将 AI 文件保存为 Jpeg2000 格式无法工作 | 错误 |
PSDJAVA-225 | 非 PassThrough 混合模式的图层组不会呈现 | 错误 |
PSDJAVA-226 | 尝试将特定 Psd 文件转换为图像时出现 NullReference 异常 | 错误 |
PSDJAVA-227 | 尝试打开特定 Psd 文件时出现 OverflowException 异常 | 错误 |
公共 API 更改
添加的 API:
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.getFileName
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.getFileSize
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.getFullPath
- M:com.aspose.psd.fileformatspsd.layers.layerresources.linkresources.LiFeDataSource.getRelativePath
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setAdobeStockId(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setDate(java.util.Date)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setElementName(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setElementRef(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setFileName(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setFileSize(long)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setFullPath(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource.setRelativePath(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getAssetLockedState
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getAssetModTime
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getChildDocId
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getCompId
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getFileCreator
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getFileType
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getLength
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getOriginalCompId
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getOriginalFileName
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getType
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getUniqueId
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.getVersion
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.hasFileOpenDescriptor
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.isLibraryLink
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setAssetLockedState(boolean)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setAssetModTime(double)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setChildDocId(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setCompId(int)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setFileCreator(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setFileOpenDescriptor(boolean)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setFileType(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setLibraryLink(boolean)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setOriginalCompId(int)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setOriginalFileName(java.lang.String)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource.setUniqueId(java.util.UUID)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource.getDataSourceCount
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource.getLength
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource.getPsdVersion
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource.getSignature
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource.isEmpty
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource.save(com.aspose.psd.StreamContainer,int)
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.Lnk2Resource.#ctor(com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource[])
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.Lnk2Resource.getKey
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LnkeResource.#ctor
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LnkeResource.#ctor(com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource[])
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LnkeResource.getKey
- M:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LnkeResource.get_Item(int)
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFdDataSource
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LiFeDataSource
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSource
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkDataSourceType
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LinkResource
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.Lnk2Resource
- T:com.aspose.psd.fileformats.psd.layers.layerresources.linkresources.LnkeResource
已移除的 API:
- M:com.aspose.psd.imageloadoptions.PsdLoadOptions.getDefaultReplacementFont
- M:com.aspose.psd.imageloadoptions.PsdLoadOptions.setDefaultReplacementFont(java.lang.String)
使用示例:
PSDJAVA-216: 支持 LnkEResource(智能对象层资源)
// 链接不同类型的资产(栅格图像、CC 库)到 PSD 的示例。
// 还考虑到 LnkeResource 的 API。
// 保留本地域中的方法的类
class LocalScopeExtension
{
void assertIsTrue(boolean condition)
{
if (!condition)
{
throw new FormatException("ExampleOfLnkEResourceSupport works incorrectly.");
}
}
void assertAreEqual(Object actual, Object expected)
{
assertIsTrue(actual != null && actual.equals(expected));
}
// 此示例演示如何获取和设置 Photoshop Psd LnkE 资源的属性,该资源包含有关外部链接文件的信息。
void exampleOfLnkEResourceSupport(
String fileName,
int length,
int length2,
int length3,
int length4,
String fullPath,
String date,
double assetModTime,
String childDocId,
boolean locked,
String uid,
String name,
String originalFileName,
String fileType,
long size)
{
String outputPath = "out_" + fileName;
// 加载预定义的 PSD
PsdImage image = (PsdImage)Image.load(fileName);
try
{
// 在全局资源中查找 LnkeResource
LnkeResource lnkeResource = null;
for (LayerResource resource : image.getGlobalLayerResources())
{
if (resource instanceof LnkeResource)
{
lnkeResource = (LnkeResource)resource;
// 验证 LnkeResource 属性
assertAreEqual(lnkeResource.getLength(), length);
assertAreEqual(lnkeResource.get_Item(0).getUniqueId(), UUID.fromString(uid));
assertAreEqual(lnkeResource.get_Item(0).getFullPath(), fullPath);
assertAreEqual(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(lnkeResource.get_Item(0).getDate()), date);
assertAreEqual(lnkeResource.get_Item(0).getAssetModTime(), assetModTime);
assertAreEqual(lnkeResource.get_Item(0).getAssetLockedState(), locked);
assertAreEqual(lnkeResource.get_Item(0).getFileName(), name);
assertAreEqual(lnkeResource.get_Item(0).getFileSize(), size);
assertAreEqual(lnkeResource.get_Item(0).getChildDocId(), childDocId);
assertAreEqual(lnkeResource.get_Item(0).getVersion(), 7);
assertAreEqual(lnkeResource.get_Item(0).getFileType().trim(), fileType);
assertAreEqual(lnkeResource.get_Item(0).getFileCreator().trim(), "");
assertAreEqual(lnkeResource.get_Item(0).getOriginalFileName(), originalFileName);
assertAreEqual(lnkeResource.get_Item(0).getCompId(), -1);
assertAreEqual(lnkeResource.get_Item(0).getOriginalCompId(), -1);
assertIsTrue(lnkeResource.get_Item(0).hasFileOpenDescriptor());
assertIsTrue(!lnkeResource.isEmpty());
assertIsTrue(lnkeResource.get_Item(0).getType() == LinkDataSourceType.liFE);
// 更新 LnkeResource 属性
lnkeResource.get_Item(0).setFullPath("file:///C:/Aspose/net/Aspose.Psd/test/testdata/Images/Psd/SmartObjects/rgb8_2x2.png");
assertAreEqual(lnkeResource.getLength(), length2);
lnkeResource.get_Item(0).setFileName("rgb8_2x23.png");
assertAreEqual(lnkeResource.getLength(), length3);
lnkeResource.get_Item(0).setChildDocId(UUID.randomUUID().toString());
assertAreEqual(lnkeResource.getLength(), length4);
lnkeResource.get_Item(0).setDate(new Date());
lnkeResource.get_Item(0).setAssetModTime(Double.MAX_VALUE);
lnkeResource.get_Item(0).setFileSize(Long.MAX_VALUE);
lnkeResource.get_Item(0).setFileType("test");
lnkeResource.get_Item(0).setFileCreator("file");
lnkeResource.get_Item(0).setCompId(Integer.MAX_VALUE);
break;
}
}
// 确保 LnkeResource 得到支持
assertIsTrue(lnkeResource != null);
// 保存加载的 PSD 的副本
image.save(outputPath, new PsdOptions(image));
}
finally
{
image.dispose();
}
// 加载保存的副本
PsdImage image1 = (PsdImage)Image.load(outputPath);
try
{
// 将 PSD 转换为 PNG 文件格式(带用于透明通道的 Alpha 通道)
PngOptions pngOptions = new PngOptions();
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
image1.save(Path.changeExtension(outputPath, "png"), pngOptions);
}
finally
{
image1.dispose();
}
}
}
LocalScopeExtension $ = new LocalScopeExtension();
// 此示例演示如何获取和设置含有外部链接 JPEG 文件信息的 Psd LnkE 资源的属性。
$.exampleOfLnkEResourceSupport(
"photooverlay_5_new.psd",
0x21c,
0x26c,
0x274,
0x27c,
"file:///C:/Users/cvallejo/Desktop/photo.jpg",
"05/09/2017 22:24:51",
0,
"F062B9DB73E8D124167A4186E54664B0",
false,
"02df245c-36a2-11e7-a9d8-fdb2b61f07a7",
"photo.jpg",
"photo.jpg",
"JPEG",
0x1520d);
// 此示例演示如何获取和设置含有外部链接 PNG 文件信息的 Psd LnkE 资源的属性。
$.exampleOfLnkEResourceSupport(
"rgb8_2x2_linked.psd",
0x284,
0x290,
0x294,
0x2dc,
"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Issues/PSDNET-491/rgb8_2x2.png",
"04/14/2020 14:23:44",
0,
"",
false,
"5867318f-3174-9f41-abca-22f56a75247e",
"rgb8_2x2.png",
"rgb8_2x2.png",
"png",
0x53);
// 此示例演示如何获取和设置含有 Adobe® Photoshop® CC 库资产信息的 Psd LnkE 资源的属性。
$.exampleOfLnkEResourceSupport(
"rgb8_2x2_asset_linked.psd",
0x398,
0x38c,
0x388,
0x3d0,
"CC Libraries Asset “rgb8_2x2_linked/rgb8_2x2”(Photoshop CC 2015 中提供的功能)",
"01/01/0001 00:00:00",
1588890915488.0d,
"",
false,
"ec15f0a8-7f13-a640-b928-7d29c6e9859c",
"rgb8_2x2_linked",
"rgb8_2x2.png",
"rgb8_2x2.png",
"png",
0);
PSDJAVA-219: 支持 britResource(亮度/对比度调整层资源)
// 此示例演示您如何以编程方式更改 PSD 图像的亮度/对比度图层资源 - BritResource。这是 Aspose.PSD 低级 API。
// 您可以通过其 API 使用亮度/对比度图层,这将更容易,但直接使用 PhotoShop 资源编辑可以更好地控制 PSD 文件内容。
String srcPath = "BrightnessContrastPS6.psd";
String outputFilePath = "BrightnessContrastPS6_output.psd";
// 加载包含亮度/对比度调整图层的 PhotoShop 文档
PsdImage psdImage = (PsdImage)Image.load(srcPath);
try
{
// 搜索 BritResource
for (Layer layer : psdImage.getLayers())
{
if (layer instanceof BrightnessContrastLayer)
{
for (LayerResource layerResource : layer.getResources())
{
if (layerResource instanceof BritResource)
{
BritResource resource = (BritResource)layerResource;
// 验证资源属性
if (resource.getBrightness() != -40 ||
resource.getContrast() != 10 ||
resource.getLabColor() ||
resource.getMeanValueForBrightnessAndContrast() != 127)
{
throw new RuntimeException("BritResource was read wrong");
}
// 更新资源属性
resource.setBrightness((short)25);
resource.setContrast((short)-14);
resource.setLabColor(true);
resource.setMeanValueForBrightnessAndContrast((short)200);
// 保存已更新 PSD 的副本
psdImage.save(outputFilePath, new PsdOptions());
break;
}
}
}
}
}
finally
{
psdImage.dispose();
}
PSDJAVA-217: 如果调整层中存在具有空边界的蒙版,则调整 PSD 文件大小不正确
// 调整包含空边界蒙版的图像大小的示例。
// 该程序加载一个预定义的 PSD 以检查是否没有异常。
final int scale = 2; // 任意系数
String[] names = {
"OneRegularAndOneAdjustmentWithVectorAndLayerMask",
"LevelsLayerWithLayerMaskRgb",
"LevelsLayerWithLayerMaskCmyk",
};
for (String name : names)
{
String srcFilePath = name + ".psd";
String dstFilePath = "output_" + srcFilePath;
String dstPngFilePath = "output_" + name + ".png";
// 加载包含具有空边界蒙版的调整图层的预定义 PSD
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setLoadEffectsResource(true);
PsdImage image = (PsdImage)Image.load(srcFilePath, psdLoadOptions);
try
{
// 调整图像大小
image.resize(image.getWidth() * scale, image.getHeight() * scale);
// 保存加载的 PSD 的副本
image.save(dstFilePath, new PsdOptions());
// 将 PSD 导出为 PNG 文件格式(带透明通道的 Alpha 通道)
PngOptions pngOptions = new PngOptions();
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
image.save(dstPngFilePath, pngOptions);
}
finally
{
image.dispose();
}
}
PSDJAVA-218: RGB 模式 16 位/通道的 Psd 图像仅在预览时更新图层
// 更新 16 位 RGB 图像的常规图层示例。该程序在每个图层上绘制某些内容
// 以确保整个图层更新正确。
String sourceFilePath = "in.psd";
String outputFilePath = "output.psd";
// 加载 16 位 RGB 模式的预定义 PSD
PsdImage image = (PsdImage)Image.load(sourceFilePath);
try
{
for (Layer layer