加载psd 文件后,水平移动图层,导出处图像后显示图层移动失败。
移动前图像:
image.jpg (135.0 KB)
移动后导出图像:
image.jpg (31.1 KB)
代码:
Image image =Image.load(path);
PsdImage psdImage = (PsdImage) image;
for(int i=0; i < psdImage.getLayers().length; i++ )
{
String name = psdImage.getLayers()[i].getDisplayName();
if (name.contains(“矩形 727 拷贝test”)) {
SmartObjectLayer smartLayer = (SmartObjectLayer)psdImage.getLayers()[i];
smartLayer.setLeft(smartLayer.getLeft() + 100);
smartLayer.setLeft(smartLayer.getLeft() + 100);
smartLayer.updateModifiedContent();
}
}
psdImage.save(img_path,new PngOptions());
以上为java 代码
OS 版本:Windows 10 专业版
Aspose版本:23.4
Java代码:
Image image =Image.load(path);
PsdImage psdImage = (PsdImage) image;
for(int i=0; i < psdImage.getLayers().length; i++ )
{
String name = psdImage.getLayers()[i].getDisplayName();
if (name.contains(“矩形 727 拷贝test”)) {
SmartObjectLayer smartLayer = (SmartObjectLayer)psdImage.getLayers()[i];
smartLayer.setLeft(smartLayer.getLeft() + 100);
smartLayer.setLeft(smartLayer.getLeft() + 100);
smartLayer.updateModifiedContent();
}
}
psdImage.save(img_path,new PngOptions());
代码更正
以上Java代码存在一行错误,更正如下:
Image image =Image.load(path);
PsdImage psdImage = (PsdImage) image;
for(int i=0; i < psdImage.getLayers().length; i++ )
{
String name = psdImage.getLayers()[i].getDisplayName();
if (name.contains(“矩形 727 拷贝test”)) {
SmartObjectLayer smartLayer = (SmartObjectLayer)psdImage.getLayers()[i];
smartLayer.setLeft(smartLayer.getLeft() + 100);
smartLayer.setRight(smartLayer.getRight() + 100); //更正代码
smartLayer.updateModifiedContent();
}
}
psdImage.save(img_path,new PngOptions());
I can confirm the issue.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PSDJAVA-463
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
什么时候能修复呢
我们这边着急用
目前的版本时不支持图层的平移吗?
目前我们在智能对象层的转换上遇到问题,其他层应该可以很好地转换。
问题修复预计时间为 23.8-23.9
Layer 这个对象的层可以转换吗?我试了也不能平移
哪种层能很好的平移?能举个例子嘛
@junjun.pan 我做了额外的调查。 如果您不使用,您的示例可以正常工作
smartLayer.UpdateModifiedContent();
看起来问题的发生是因为智能对象的左右变化并没有改变它的矢量数据。
请尝试以下方法:
Image image = Image.load(path);
PsdImage psdImage = (PsdImage) image;
for(int i=0; i < psdImage.getLayers().length; i++ )
{
String name = psdImage.getLayers()[i].getDisplayName();
if (name.contains(“矩形 727 拷贝test”))
{
SmartObjectLayer smartLayer = (SmartObjectLayer)psdImage.getLayers()[i];
smartLayer.setLeft(smartLayer.getLeft() + 100);
smartLayer.setRight(smartLayer.getRight() + 100); //更正代码
// Remove this: smartLayer.updateModifiedContent();
}
}
psdImage.save(img_path,new PngOptions());