Hello, I am trying to import word document with gif file but when I try to create document based on Document(inputStream) after that I have inside document Shape with ImageData which ImageType automatically converted to PNG. As far as understand Aspose converts images automatically (because inside word file I have for sure gif). Is there any was to control this conversion?
@PROCUREMENT2 Could you please attach your input and output document here for testing? We will check the issue and provide you more information.
Unfortunately, there is no way to control this, but Aspose.Words supports GIF images in the model, so it should not be converted to PNG. Though old versions of Aspose.Words really did not support GIF images and converted them to PNG. Which version do you use?
Document doc = new Document( Files.newInputStream(Path.of("GIF.docx"), StandardOpenOption.READ)); boolean isPng = ((Shape) doc.getChildNodes(NodeType.SHAPE,true).get(0)) .getImageData().getImageType() == ImageType.PNG;
has in isPng true but inside docx file we have standard gif.
@PROCUREMENT2 Thank you for additional information. Actually if you process your document GIF image is preserved as is. For example see the following code:
Document doc = new Document("C:\\Temp\\in.docx"); doc.save("C:\\Temp\\out.docx"); // GIF will be preserved
But when you assess
ImageData image is converted to PNG. So you get
ImageType.PNG. Also, you can notice that
ImageType does not have
GIF value. This is related to the fact that
ImageType returns values that correspond to MSOBLIPTYPE in the Binary Drawing format, which also does not have GIF.