Thanks to several people who helped on this (names not listed so they don't get emails from others).
WordML:
The binData is uuencoded - so first decode it.
Uncompress:
The binary file is a gzip. So ungzip it. Note: this is not a winzip type zip.
The file is now a "placeable" metafile. Interestingly, all documentation about this by Microsoft says this is not a supported format and that Microsoft does not use it. The file structure is:
WmfPlaceableFileHeader; // in GdiPlusMetaHeader.h
METAHEADER; // in WinGDI.h
[] METARECORD; // in WinGDI.h
When WmfPlaceableFileHeader is read, you have 4 shorts that are the image bounding box and then a word (called inches) that is the twips/inch for the image. If you use the box to get the width & height, then width/inches is the width of the image in inches and height/inches is the height.
This means that a width of 1.0 means the image is 1" across. This says nothing about the number of pixels because a wmf is by definition resolution independent so your dpi settings determine the pixel size.
Rtf:
This is not uuencoded and is not zipped. It is an ascii listing of the binary. So all chars are 0-9,A-F. Each pair of characters becomes a byte of data. In other words the string "01F4" becomes 2 bytes 0x01,0xF4.
This is then a metafile. Not a placeable metafile, but a plain old METAFILE with the standard 18 byte header where the start is 01000900. The size of this metafile must be pulled from the \sp tags before the wmf in the rtf file.
As with xml, your DPI settings, along with the \sp values, are used to determine the pixel size of the final image. And as with the xml case, the documentation for a wmf file is spotty.
Do you find this useful? If so please check out Windward Reports.

Comments