What is MIME type "image/cgm"?
A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.
image/cgm is the MIME type for files that use the Computer Graphics Metafile format.It tells systems how to handle image data that is stored in vector format.
Files with this MIME type often store technical illustrations. They can describe lines, curves, text, and shapes in a scalable way so the image remains clear at any size.
- Used for engineering and architectural drawings
- Supports high-quality technical diagrams
- Combines vector and text instructions for precise rendering
- Useful in industries where detail and scalability are key
Associated file extensions
Usage Examples
HTTP Header
When serving content with this MIME type, set the Content-Type header:
Content-Type: image/cgm
HTML
In HTML, you can specify the MIME type in various elements:
<a href="file.dat" type="image/cgm">Download file</a>
Server-side (Node.js)
Setting the Content-Type header in Node.js:
const http = require('http');
http.createServer((req, res) => {
res.setHeader('Content-Type', 'image/cgm');
res.end('Content here');
}).listen(3000);
Associated file extensions
FAQs
Do web browsers natively support image/cgm?
No, modern web browsers like Chrome, Firefox, and Edge do not natively display image/cgm files. To show these technical illustrations on a webpage, you typically need to convert them to a web-standard vector format like image/svg+xml or use a third-party plugin/viewer.
How do I configure Apache or Nginx to serve .cgm files?
You must ensure the server sends the correct Content-Type header. For Apache, add AddType image/cgm .cgm to your configuration or .htaccess file. For Nginx, include image/cgm cgm; inside your types block or mime.types file.
What software opens files with the image/cgm MIME type?
Files served as image/cgm are usually opened with professional vector graphics or CAD software. Common applications include CorelDRAW, Adobe Illustrator, and specialized engineering viewers like Larson CGM. Standard photo viewers will generally not recognize this format.
What is the difference between image/cgm and image/svg+xml?
While both are vector formats, image/svg+xml is the modern standard for web graphics and is supported by all browsers. image/cgm is an older ISO standard primarily used in engineering, aviation, and geophysics for technical data exchange and is rarely used for general web design.
Why is my browser downloading the .cgm file instead of displaying it?
Since browsers cannot render image/cgm internally, the default behavior is often to download the file so the user can open it with a local application. If you want the image to appear inside the browser window, you must convert the file to a supported format like SVG, PNG, or application/pdf.
Are image/cgm files safe to open?
generally yes, but like any complex file format, malformed image/cgm files can potentially exploit vulnerabilities in older viewing software. Always ensure your CAD tools or vector editors are updated to the latest version when opening files from untrusted sources.
General FAQ
What is a MIME type?
A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.
MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.
How do I find the MIME type for a file?
You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.
Why are multiple MIME types listed for one extension?
Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.