Image generated with poor quality - aspose word

Hello Team,

I am using aspose Word to produce files containing images. However, I’m noticing a significant degradation in the image quality when they’re embedded within the Word files. Could you offer any insights into what might be causing this issue?

Additionally, I observed that you addressed this problem in versions that are compatible with Java 17. Below is the Java code snippet I’m using to retrieve the diagram.

I use the last version aspose word but the problem still persists.

Thanks,

//
String fn = sourceObject.getRoot().currentEnvironment().getMegaUserPath() + logigramme.getProp(Constant.AIE_SHORT_NAME) + ".jpg";
int height = md.getDrawingBoundHeight();
int width = md.getDrawingBoundWidth();
md.saveAsPicture(fn, 2, 8, 100, 10, height, width);
builder.insertImage(fn);
//

@MOURADI Could you please attach the problematic image and output document produced by Aspose.Words? Also, please make sure the image before inserting it using Aspose.Words into the document has the desired quality. Actually Aspose.Words usually does not change the image upon inserting.

@alexey.noskov Thank you for your response. Attached is the document generated with the low-quality image, along with the desired image in both JPG and PNG formats.

Desired quality.jpg (49.7 KB)

Desired quality.png (32.3 KB)

Report Procédure.docx (38.4 KB)

@MOURADI Unfortunately, I cannot reproduce the problem on my side using the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage("C:\\Temp\\Desired quality.png");
builder.writeln();
builder.insertImage("C:\\Temp\\Desired quality.jpg");
doc.save("C:\\Temp\\out.docx");

out.docx (66.5 KB)