The support I provided for getting pictures was only getting out the bitmaps. The following patch adds support for any kind of image stored in a BLIP.
Created attachment 20663 [details] Proposed patch
On second thought it looks like this will need a little more work. The binary exposed is in itself not the picture data. I'll get a better patch in once I've figured out how this F01A blip works.
Created attachment 20666 [details] Proposed patch, v2 Here's a better version, defines an EscherMetafileBlip class which properly handles at least EMF. I can't find the record IDs for WMF and PICT anywhere. If someone could create a file with those types of BLIP inside, I would be grateful, but even if I put a WMF into the document on my copy of Word, I seem to get an EMF.
I'm pretty sure that Yegor will have a look at this patch some time next week, he'll have an example of a PICT and maybe an EMF.
I meant WMF, not EMF.
I reviewed and committed the patch. The code works fine for EMF and WMF but fails on PICT. See how I read PICT in org.apache.poi.hslf.blip.PICT. The header is different from WMF/EMF and you should skip different number of bytes before inflating the data. How did you test your code? Would you provide a unit test? I provided two xls files: src\testcases\org\apache\poi\hssf\data\SimpleWithImages.xls Created on Windows. Contains JPEG, PNG, EMF and WMF. src\testcases\org\apache\poi\hssf\data\SimpleWithImages-mac.xls Created on MAC. Contains JPEG, PNG and PICT. The point is that MS Office for MAC automatically converts WMF and EMF into PICT and vise versa - MS Office for Windows automatically stores PICT as WMF. So there are two test files. All the pictures can be found in src\scratchpad\testcases\org\apache\poi\hslf\data\ src\testcases\org\apache\poi\hssf\usermodel\TestHSSFPictureData.java Add your test logic in this file. It already contains tests for JPEG and PNG. Regards, Yegor
I'll get onto writing that unit test as soon as I'm done with my current round of changes. At the moment my own code is in disarray from working on another feature.
make sure this doesn't break the existing stuff for drawing Escher images in Excel...
I think most of these changes are applied since some time and there was updated support for EMF/WMF in some areas lately (more exctraction than HSSF directly though), however I don't think this is still applicable and thus won't be applied unless someone comes up with an up-to-date set of changes.