public static void main(String[] args) throws Exception{
try {
PsdImage psdImage = (PsdImage)Image.load("D:\\工作资料\\T恤切片模板-XL.psd");
for (Layer layer: psdImage.getLayers()){
if(layer instanceof SmartObjectLayer){
System.out.println(layer.getName());
SmartObjectLayer smartObjectLayer = (SmartObjectLayer) layer;
//smartObjectLayer.convertToLinked("D:\\工作资料\\新版跑图\\易品圆领卫衣切片模板-XS.jpg");
//smartObjectLayer.relinkToFile("D:\\工作资料\\新版跑图\\易品圆领卫衣切片模板-XS.jpg");
//smartObjectLayer.replaceContents("D:\\工作资料\\新版跑图\\易品圆领卫衣切片模板-XS.jpg");
//smartObjectLayer.getSmartObjectProvider().updateAllModifiedContent();
smartObjectLayer.save("D:\\工作资料\\test1.png");
}
}
//psdImage.save("D:\\工作资料\\test.png", new PngOptions());
} catch (Exception e) {
e.printStackTrace();
}
}
@summerxiong
Could you please provide input file you are tried to update. I will add it to the task that I created for you
PSDJAVA-405: Working with SmartObject leads to the exception
You can track this task by its ID