Image MIME Reference
CGM
Computer Graphics Metafile
image/cgm
VS
X Bitmap (Legacy MIME Alias)
image/x-xbm
XBM
A complete technical comparison of Computer Graphics Metafile and X Bitmap (Legacy MIME Alias) — covering compression, feature support, browser compatibility, magic bytes, and when to choose each format.
Equal browser support
Feature Support
| Feature | CGM | XBM |
|---|---|---|
| Transparency (Alpha) | Yes | Yes |
| Animation Support | ✕ No | ✕ No |
| Progressive Loading | ✕ No | ✕ No |
| HDR Support | ✕ No | ✕ No |
| EXIF Metadata | ✕ No | ✕ No |
| ICC Color Profile | Yes | ✕ No |
Computer Graphics Metafile
image/cgm
Extension
.cgm
Container
CGM
Compression
Uncompressed / Binary / Character / Clear Text
Algorithm
Deflate (in some WebCGM profiles)
Color Depth
8-bit, 16-bit, 24-bit, 32-bit
Developed by
ISO / IEC
Released
1987
Magic Bytes
00 20 (Binary) / 42 45 47 49 4E 20 4D 45 54 41 46 49 4C 45 (Clear Text)
X Bitmap (Legacy MIME Alias)
image/x-xbm
Extension
.xbm
Container
C Source Code Header (.h)
Compression
Uncompressed (Source Code)
Algorithm
None
Color Depth
1-bit (Monochrome)
Developed by
MIT / X Consortium (X Window System)
Released
1988
Magic Bytes
23 64 65 66 69 6e 65 (ASCII '#define')
Browser Support Comparison
| Browser | CGM | XBM |
|---|---|---|
|
|
✕ | ✕ |
|
|
✕ | ✕ |
|
|
✕ | ✕ |
|
|
✕ | ✕ |
|
|
✕ |
✓
|
CGM
CGM Strengths
- Strictly standardized by ISO, ensuring long-term archiving and cross-platform compatibility in engineering
- Excellent support for rich metadata, hyperlinks, and technical hotspots via the WebCGM profile
- Can store complex 2D geometry, rasters, and text in a single lightweight file
Limitations
- Multiple encoding schemes (Binary, Character, Clear Text) make parser development difficult
- Zero native support in modern web browsers without third-party plugins
- Largely replaced by SVG for general-purpose 2D vector graphics on the web
XBM
XBM Strengths
- Can be compiled directly into C or C++ source code without needing an external file loader or binary asset manager
- Human-readable structure allows developers to inspect, edit, or hand-craft tiny icons directly within a text editor
- Extremely predictable and lightweight for 1-bit hardware displays and embedded systems
Limitations
- Strictly limited to 1-bit monochrome (black and white) graphics with no gray or color support
- Text-based C syntax creates massive file bloat compared to binary 1-bit formats like PBM
- Completely deprecated in modern web browsers and desktop GUI frameworks
When to choose which format
CGM
Use CGM when…
- Technical Illustrations
- Aerospace & Defense (S1000D)
- CAD/CAM
- Geophysics
XBM
Use XBM when…
- X Window System (X11) Cursors and Icons
- Embedded C/C++ Firmware UI Assets
- Early 1990s Unix Web Graphics