Extended
image/emf
Magic Bytes
Offset: 0
01 00 00 00
The Enhanced Metafile (EMF) is a 32-bit vector graphics format developed by Microsoft as the successor to the original 16-bit Windows Metafile. It is primarily utilized within the Windows operating system for print spooling and high-resolution graphical data exchange between productivity applications and the system clipboard. Although now considered a legacy format compared to modern standards like SVG, it remains widely supported for backward compatibility and is generally classified as safe for standard image viewing.
Validation Code
How to validate .emf files in Python
Python
def is_emf(file_path: str) -> bool:
"""Check if file is a valid EMF by magic bytes."""
signature = bytes([0x01, 0x00, 0x00, 0x00])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .emf files in Node.js
Node.js
function isEMF(buffer: Buffer): boolean {
const signature = Buffer.from([0x01, 0x00, 0x00, 0x00]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsEMF(data []byte) bool {
signature := []byte{0x01, 0x00, 0x00, 0x00}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/emf
curl https://filesignature.org/api/v1/emf