How can i insert a webp image into a docx file?

In my Word document, I would like to replace some placeholders with .jpeg files. However, they are taking up a lot of space, so I thought I would convert them to .webp files and insert them into my word document. After converting those .jpeg files to webp using Aspose.Imaging, I get an error when I try to replace placeholders in my word document with those webp files. I used code form this ticket in order to do that Replacing text placeholder "<<Logo>>" with an image - Free Support Forum - aspose.com, but it seems it doesn’t recognize webp files. I didn’t see any image device in aspose.words and i get an error that says it doesn’t recognize a bitmap…

e.g.

 builder.InsertImage(imageFile, RelativeHorizontalPosition.Margin, 0, RelativeVerticalPosition.Margin, 0, 495, 742, WrapType.Through);
 builder.InsertBreak(BreakType.SectionBreakNewPage); //image file is of type .webp

@panCognity Could you please attach the problematic image here for testing? Also, please note WEBP images are currently supported only in .NET Standard 2.0 and .NET6 version of Aspose.Words starting from 23.12 version. If you are using an old version, please update to the latest version of Aspose.Words.

1 Like

I use .net 6.0, but I had Aspose.Words 23.10. You are totally right. I updated the version and now everything works just fine! Thank you!
Can PDF files be converted to webp images directly? In the documentation for aspose.pdf, I couldn’t find anything.

@panCognity

You should ask the question in Aspose.PDF support forum. My colleagues from Aspose.PDF will help you shortly.

1 Like

Thank you for! I appreciate your advice and suggesting the right forum!

1 Like