We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Docx image save creates blurry wmf images

Hi, WMF images that we extract from docx files are blurred when we extract then one at a time. For example using the following code.

//DrawingML drawNode
drawNode.GetShapeRenderer().Save(fullPath, new ImageSaveOptions(SaveFormat.Png));
//Shape shapeNode
shapeNode.GetShapeRenderer().Save(fullPath, new ImageSaveOptions(SaveFormat.Png));

However, when we convert the docx file to Html the images are extracted without blurring. Using the following.

Document doc = new Document(@“C:\Projects\convertToHtml\image only.docx”);
HtmlSaveOptions so = new HtmlSaveOptions(SaveFormat.Html);
doc.Save(@“C:\Projects\convertToHtml\image only.html”, so);

How can we get images extracted without blurring using the GetShapeRenderer().Save method?

I have attached the relevant files in a zip.

Hi George,

Thanks for your inquiry. Please try using the following code:

Document doc = new Document(MyDir + @“blurred\image

Shape shapeNode = doc.FirstSection.Body.Paragraphs[1].FirstChild as Shape;

ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.Png);

saveOptions.MetafileRenderingOptions.RenderingMode = MetafileRenderingMode.Vector;

shapeNode.GetShapeRenderer().Save(MyDir + @"blurred\15.10.0.png", saveOptions);

Hope, this helps.

Best regards,

Thank you Awais,

That worked perfectly!