{"id":"image-x-emf","mimeType":"image/x-emf","name":"Windows Enhanced Metafile","shortName":"EMF","category":"Vector Graphics \u0026 Legacy","extensions":[".emf"],"description":"The image/x-emf MIME type represents the Windows Enhanced Metafile (EMF) format, a 32-bit vector graphics format introduced by Microsoft in 1993 with Windows NT 3.1. Developed as the successor to the 16-bit Windows Metafile (WMF), EMF was designed to resolve its predecessor's device-dependency and precision limitations. Rather than storing a rasterized pixel grid, an EMF file contains a sequence of drawing commands (such as paths, polygons, and text) passed to the Windows Graphics Device Interface (GDI) and GDI+. While it scales flawlessly and remains heavily used within the Microsoft Office ecosystem and Windows print spooling, it lacks native support on the modern web and non-Windows platforms.","seo":{"title":"image/x-emf MIME Type | Developer Reference for Windows Enhanced Metafile","description":"Complete reference for the image/x-emf MIME type: Windows Enhanced Metafile (EMF), GDI and GDI+ drawing commands, legacy MS Office graphics, and file detection.","faqs":[{"question":"What is an EMF file?","answer":"An EMF (Enhanced Metafile) is a 32-bit vector graphic format developed by Microsoft. It stores a list of drawing commands that tell the Windows operating system how to render the image, ensuring it can scale to any size without losing quality."},{"question":"What is the difference between EMF and WMF?","answer":"WMF (Windows Metafile) is the original 16-bit format introduced in 1990, which suffered from device-dependency issues (rendering differently on different printers or screens). EMF is its 32-bit successor, offering true device independence, better color support, and richer drawing commands via GDI+."},{"question":"Can I use EMF files on a website?","answer":"No. Modern web browsers do not support rendering EMF files. For web development, you should convert EMF graphics into SVG (Scalable Vector Graphics) files using software like Inkscape or Adobe Illustrator."}]},"index":{"compression":["Uncompressed (Binary Drawing Records)"],"browserSupport":{"score":1,"label":"None"},"commonUses":["Microsoft Office Vector Graphics and Clip Art","Windows Print Spooling (EMF Spool Files)","High-fidelity Vector Interchange on Windows"]},"technical":{"magicBytes":{"hex":"01 00 00 00 (Header Type) ... 20 45 4D 46 (Signature at offset 40)","ascii":"\\x01\\x00\\x00\\x00 ...  EMF"},"container":"Windows GDI/GDI+ Record Sequence","compressionAlgorithm":["None"],"colorDepth":["Vector (32-bit GDI/GDI+ Colors)","Supports embedded 24-bit/32-bit bitmaps"],"transparency":true,"animation":false,"metadata":{"exif":false,"xmp":false,"iccProfile":true},"alphaChannel":true,"progressiveLoading":false,"hdrSupport":false},"history":{"developer":"Microsoft Corporation","released":"1993","specification":"MS-EMF (Microsoft Open Specifications)"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":true},"softwareSupport":[{"name":"Microsoft Office (Word, PowerPoint, Excel)","logo":""},{"name":"Inkscape","logo":""},{"name":"Adobe Illustrator","logo":""},{"name":"ImageMagick","logo":"image-magic.webp"}],"conversion":{"convertTo":["svg","png","wmf"],"convertFrom":["wmf","svg"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/x-emf"},{"header":"Content-Type","value":"image/emf"},{"header":"Content-Type","value":"application/x-emf"}],"htmlAccept":"image/x-emf, .emf","fileDetection":["An EMF file always begins with an EMR_HEADER record. The first 4 bytes indicate the record type (0x00000001, little-endian: 01 00 00 00).","To definitively identify an EMF file, check the 4-byte signature located precisely at offset 40 (0x28). It will contain the ASCII string ' EMF' (Space-E-M-F, Hex: 20 45 4D 46)."]},"prosCons":{"pros":["Device independent, meaning it renders consistently across different monitors and printers regardless of resolution","Fully supports 32-bit precision and advanced GDI+ drawing commands, including alpha transparency and anti-aliasing (EMF+)","Native rendering within the Windows OS ensures fast performance and flawless fidelity in Microsoft Office applications"],"cons":["Heavily tied to the Windows Graphics Device Interface API, making it notoriously difficult to parse perfectly on macOS or Linux","Completely unsupported by modern web standards; cannot be embedded in HTML without conversion to SVG","Security history: Like WMF, malicious drawing records can theoretically exploit vulnerabilities in older GDI parsers"]},"specifications":{"url":"https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-emf/502ed28a-34c5-4373-ba16-ceceb58d264a","rfc":"","mimeAliases":["image/emf","application/x-emf","application/emf"]},"developerSnippets":{"python":"import magic\n# Libmagic natively detects the 'Windows Enhanced Metafile' signature\nprint(magic.from_file('vector.emf', mime=True)) # Outputs 'image/x-emf'","nodejs":"const fs = require('fs');\n// Manually detecting the EMF signature at offset 40\nconst buffer = Buffer.alloc(44);\nconst fd = fs.openSync('vector.emf', 'r');\nfs.readSync(fd, buffer, 0, 44, 0);\nfs.closeSync(fd);\n// Check header type (0x01) and signature (' EMF')\nconst isEMF = buffer.readUInt32LE(0) === 1 \u0026\u0026 buffer.toString('ascii', 40, 44) === ' EMF';\nconsole.log('Is Windows EMF:', isEMF);","go":"import (\n    \"bytes\"\n    \"os\"\n)\n// Native Go HTTP detection does not recognize EMF.\n// You must read the first 44 bytes and verify the signature at offset 40:\n// isEMF := len(buf) \u003e= 44 \u0026\u0026 bytes.Equal(buf[0:4], []byte{0x01, 0x00, 0x00, 0x00}) \u0026\u0026 bytes.Equal(buf[40:44], []byte(\" EMF\"))","php":"$mime = mime_content_type('vector.emf');\necho $mime; // Depending on server definitions, often resolves to 'image/x-emf' or 'application/x-msmetafile'"},"relatedFormats":["wmf","svg"]}
