Page 1 of 1

Bitmaps (.bmp) not a natively supported word image type?

PostPosted: Wed Jun 22, 2011 7:23 am
by LokiTC
When I try adding a bitmap (.bmp) to a word document, as per the examples, I get exceptions as below. It appears from looking at the source code ( BinaryPartAbstractImage.java@1541, line 311 onward) that .bmps are not in the list of natively supported image types for Word. I think they are supported, are they not? So, should they not be included in this case/list?

Thanks,

LTC


---------------------------------

WARNING: org.docx4j.openpackaging.exceptions.Docx4JException: Error checking image format
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.ensureFormatIsSupported(BinaryPartAbstract
Image.java:320)
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.createImagePart(BinaryPartAbstractImage.ja
va:192)
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.createImagePart(BinaryPartAbstractImage.ja
va:154)

... more stack trace ...

at java.lang.Thread.run(Thread.java:619)

Caused by: java.io.IOException: Cannot run program "imconvert": CreateProcess error=2, The system cannot find the file specif
ied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.convertToPNG(BinaryPartAbstractImage.java:
792)
at org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage.ensureFormatIsSupported(BinaryPartAbstract
Image.java:306)
... 44 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.$$YJP$$create(Native Method)
at java.lang.ProcessImpl.create(ProcessImpl.java)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 49 more

Re: Bitmaps (.bmp) not a natively supported word image type?

PostPosted: Wed Jun 22, 2011 1:20 pm
by jason
If you had ImageMagick set up, that would have converted it to a png, and everything would have worked.

But as you point out, native support is possible, so i've added it: http://dev.plutext.org/trac/docx4j/changeset/1556

Re: Bitmaps (.bmp) not a natively supported word image type?

PostPosted: Thu Jun 23, 2011 1:50 am
by LokiTC
Ok, thanks for that!

I did realize I could use ImageMagick if necessary, but one less thing to install if we can do without it.

LTC