Html to Word doc images have fuzzy resolution

Hi,

I’m trying to convert an HTML document to a Word document. It seems that the images are converted to the wrong resolution. Here’s an example.

What happens is that the image gets shrunken to 720 wide x 540 tall. If you do a “Save as Picture” in Word, you can see that resolution. But then Word scales it back up to 960 x 720 in the document, and it just looks a little fuzzy.

Is there some setting that we’re missing to convert things correctly?

Here’s our Java code:

Document doc;
License license = new License();

    license.setLicense(ClassLoader.getSystemResourceAsStream("Aspose.Words.lic"));
    LoadOptions loadOptions = new LoadOptions();
    loadOptions.setBaseUri(urlToSource);
    loadOptions.setEncoding(Charset.forName("UTF-8"));

    if (htmlDocumentPath != null) {
        doc = new Document(new FileInputStream(new File(htmlDocumentPath)), loadOptions);
    } else {
        doc = new Document(ClassLoader.getSystemResourceAsStream("audit_report.html"), loadOptions);
    }
    if (outputPath != null) {
        doc.save(outputPath + "/AuditReport.docx", SaveFormat.DOCX);
        return "Saving Document to " + outputPath + "/AuditReport.docx";

    } else {
        doc.save("./AuditReport.docx", SaveFormat.DOCX);
        return "Saving Document to AuditReport.docx";
    }

Hi Rex,

Thanks for your inquiry. Perhaps, you are using an older version of Aspose.Words; as with Aspose.Words v14.12.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v14.12.0 and let us know how it goes on your side. I hope, this will help.

Look at GitHub - rexmadden/aspose-image-resolution-bug: Demonstrates Aspose Words scaling an image down and then back up on a conversion from HTML to Docx.

There’s an example Word doc and image in there that are scaled funny. The Main.java will also recreate it. Using the latest Aspose Words 14.12.0

Hi Rex,

Thanks for your inquiry. I have tested again the same scenario and have not found the shared issue. Please check the attached images for detail. Moreover, I have not found this issue with your shared document (image_bug.docx).

Could you please open the shared image-bug.html in MS Word and save it to Docx using MS Word and repeat the same scenario? Please also share which MS Word version you are using. I have checked the output document in MS Word 2013.