hey! imho, there are some incorrectness in the construction of the DIB header: " //Specifies the size, in bytes, of the bitmap file. LittleEndian.putInt(header, 2, data.length); //DIB length including the header" well, if it specifies the size of the file including the header then it should be something like: LittleEndian.putInt(header, 2, data.length + header.lenght); "//the offset, in bytes, from the header to the bitmap bits (looks like it is always 2) LittleEndian.putInt(header, 10, 2);" the size of the header is 14 bytes, so this field should be at least 14 (this is the basic header, almost in all DIB's there are another header following this one, but I don't know should it be here or not...) so if you use only this header, this fiels should be exactly 14. hope this info will be useful. mike.
I am experiencing the same issue with version 3.6 (poi-scratchpad-3.6-20091214.jar). Attaching here a modified org.apache.poi.hslf.blip.DIB code Basically the current function getData() adds a proper header. I made a small modification to produce the correct header values and renamed the function to addBMPHeader(). I then created a wrapper so the original getData() is intact. I exposed addBMPHeader() as a separate public static method, because there are other cases where you need to append a header to the raw DIB information stored in the OLE2 stream. For example in Excel tables. I will attach the test case for this situation.
Created attachment 24974 [details] Changes in org.apache.poi.hslf.blip.DIB to fix the issue
Patch applied in r949483. Thanks, Yegor