@Luo.Lingfeng I have update of this task. Dev team finishes the support of Mesh Warp Transformation in the other task, so, the update will be in 25.11.
Here is how it will work in 25.11 in comparison with PS:
photo_5435889877913828026_y.jpg (213.1 KB)
@Dmitriy.Sorokin We are using JAVA, will you update Aspose.PSD for Java
@Luo.Lingfeng release of Aspose.PSD for Java is in progress. It should be made soon.
What date is your update scheduled to be released in November? I would like to know the specific date
@Luo.Lingfeng We don’t have an exact date yet. The release will be published when it’s ready. Please wait for the release updates.
It’s already the end of November, why hasn’t the November version been updated yet
@Luo.Lingfeng There was an issue in release process for all Aspose teams. We are finishing publishing of 25.11. The release will be madde this week. Release notes are already updated. New Mesh warp is included: Aspose.PSD for .NET 25.11 - Release Notes TheJava team also finishes Java release.
The grid deformation still has issues, and the replaced image does not match the original effect
test PSD
@Dmitriy.Sorokin I have sent you my test file, you can test the effect
@Luo.Lingfeng could you please additionally provide code to reproduce the issue. Aspose.PSD team only started to support this type of warp, so, the quality of rendering will be continuously improve.
@Dmitriy.Sorokin
public ByteArrayOutputStream imageProcess(InputStream psd, InputStream pic, String layerName, String text, String filename) {
PsdLoadOptions loadOptions = new PsdLoadOptions();
loadOptions.setUseDiskForLoadEffectsResource(false);
loadOptions.setAllowWarpRepaint(true); // 关键设置:允许重绘扭曲效果
loadOptions.setLoadEffectsResource(true); // 加载效果资源
boolean isText = false;
if (text != null && !text.isEmpty()) {
System.out.println("has text");
// 加载效果资源
loadOptions.setLoadEffectsResource(true);
isText = true;
}
byte[] bytesPsd = null;
try {
bytesPsd = psd.readAllBytes();
} catch (IOException e) {
log.error("psd-error:", e);
throw new RuntimeException(e);
}
ByteArrayOutputStream outputStream = null;
try (Image image = PsdImage.load(new ByteArrayInputStream(bytesPsd), loadOptions);
Image rePic = Image.load(pic)) {
if (!(image instanceof PsdImage psdImage)) {
throw new RuntimeException("Loaded image is not PsdImage, but " + image.getClass());
}
if (psdImage.getLayers().length == 0) {
return psdProcess(bytesPsd);
}
Layer[] layers = psdImage.getLayers();
for (int i = 0, layersLength = layers.length; i < layersLength; i++) {
Layer layer = layers[i];
if (layer instanceof SmartObjectLayer smartObj) {
if (layer.getName().contains(layerName)) {
int width = smartObj.getContentsBounds().getWidth();
int height = smartObj.getContentsBounds().getHeight();
rePic.resize(width, height, ResizeType.Bell);
smartObj.replaceContents(rePic);
}
}
if (isText) {
if (layer instanceof TextLayer textLayer) {
textLayer.updateText(text);
}
}
}
outputStream = new ByteArrayOutputStream();
JpegOptions options = new JpegOptions();
psdImage.save("E:\\workspaces\\stjar\\src\\main\\resources\\doc\\" + filename, options);
if (!psdImage.getDisposed()) {
psdImage.dispose();
}
return outputStream;
} catch (Exception e) {
log.error("图片处理失败: {}", e.getMessage(), e);
throw new RuntimeException("图片处理失败", e);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error("流关闭异常: {}", e.getMessage());
}
}
}
}
@Dmitriy.Sorokin The deformation effect of the evenly divided grid meets expectations, but the custom grid differs considerably.
@Dmitriy.Sorokin That’s right, it’s the difference caused by evenly dividing the mesh and custom mesh in mesh deformation. Using evenly divided meshes is not a problem. I hope to update and support free meshes as soon as possible