Results 1 to 3 of 3

Thread: WMZ/EMZ format details

  1. #1
      vikas is offline
    Guild Applicant
    Join Date
    Sep 2008
    Posts
    1

    Question WMZ/EMZ format details

    Dear Experts...

    I am looking forward for information of comprssed window metafile .Actually window metafile is an format came in follwoing variations:-

    -wmf
    -emf
    - 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.

    Thanks;
    Kind Regards
    Vikas

  2. #2
    Guild Master Gracious Donor Midgardsormr's Avatar
    Join Date
    Aug 2007
    Location
    Los Angeles, CA
    Posts
    2,408

    Post

    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) */
    } WMFHEAD;

    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 */
    } WMFRECORD;

    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 */
    } WMFSPECIAL;

    from: http://www.fileformat.info/format/wm...ICMETA-DMYID.4

    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.
    Last edited by Midgardsormr; 09-07-2008 at 02:06 PM. Reason: more info
    Bryan Ray, visual effects artist
    http://www.bryanray.name

  3. #3
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,778
    Blog Entries
    4

    Post

    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

    http://sourceforge.net/projects/mingw/

    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

    http://www.zlib.net/
    Last edited by Redrobes; 09-07-2008 at 02:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •