View Full Version : WMZ/EMZ format details
09-04-2008, 05:18 AM
I am looking forward for information of comprssed window metafile .Actually window metafile is an format came in follwoing variations:-
- Comressed wmf(called wmz)
-Comprssed emf(called emz)
I am looking forward for information about the comprsed wmf/emf format. But get not much information except it is comprssed version having 24 bpp(bit per pixel).
I would like to know more about comprssed wmz and emz. If anybody have any information regarding wmz or emz ,then kindly help me. I would like to know the structure of wmz and emz like header and data part.
09-07-2008, 02:56 PM
Windows metafile is a vector format. It consists of a header containing information about the file, followed by instructions for the Windows Graphics Device Interface (GDI). These instructions tell the operating system how to render the objects described by the file.
A metafile can also contain a bitmap file, but in that case, the metafile is just a "wrapper" for the bitmap. The operating system renders it just as though it were a normal bitmap, but it cannot be directly edited in Photoshop or the like--it must be extracted from the metafile first.
A compressed metafile is the same thing, except compressed with the same algorithm used in zip files, which is called DEFLATE. Unlike zip, though, a wmz or emz can contain only one compressed file.
That's about the extent of my knowledge on that subject. I don't do any Windows programming, so I don't know anything about the GDI or its functions.
Very interesting question!
edit: I just reread your question, and you'd asked about the structure of the header and data. Here's a summary of the contents of the header:
The header is 18 bytes in length and is structured as follows:
typedef struct _WindowsMetaHeader
WORD FileType; /* Type of metafile (1=memory, 2=disk) */
WORD HeaderSize; /* Size of header in WORDS (always 9) */
WORD Version; /* Version of Microsoft Windows used */
DWORD FileSize; /* Total size of the metafi+le in WORDs */
WORD NumOfObjects; /* Number of objects in the file */
DWORD MaxRecordSize; /* The size of largest record in WORDs */
WORD NoParameters; /* Not Used (always 0) */
That would be followed by a series of instructions to the GDI, like so:
typedef struct _WindowsMetaRecord
DWORD Size; /* Total size of the record in WORDs */
WORD Function; /* Function number (defined in WINDOWS.H) */
WORD Parmeters; /* Parameter values passed to function */
There may also be an additional header that allows the metafile to be used in an application other than the one it was created in. It has this format:
typedef struct _WmfSpecialHeader
DWORD Key; /* Magic number (always 9AC6CDD7h) */
WORD Handle; /* Metafile HANDLE number (always 0) */
SHORT Left; /* Left coordinate in metafile units */
SHORT Top; /* Top coordinate in metafile units */
SHORT Right; /* Right coordinate in metafile units */
SHORT Bottom; /* Bottom coordinate in metafile units */
WORD Inch; /* Number of metafile units per inch */
DWORD Reserved; /* Reserved (always 0) */
WORD Checksum; /* Checksum value for previous 10 WORDs */
This is all C code, so it would need to be compiled before it was useable. You could write the metafile in any programming language, of course.
There is lots more information in the article I linked to above, including what looks like a nearly comprehensive list of GDI functions.
09-07-2008, 03:21 PM
I think Midgard covered that pretty extensively !
All I would add is that usually when a file format has the z on the end its been compressed with the 'deflate' as midgard said. You can usually take one of those files and run it through gunzip.exe and rename the result to the non 'z' version and treat it like one of them.
You can get gzip (the compressor) and gunzip (the un compressor) from the GNU tools for windows site called MinGW here
EDIT -- I should also add that if your programming in 'C' or similar then the ubiquitous free library to do that deflate conversion is zlib
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.