{"id":"image-x-canon-cr2","mimeType":"image/x-canon-cr2","name":"Canon Raw Version 2","shortName":"Canon-CR2","category":"Photography \u0026 Raw Imaging","extensions":[".cr2"],"description":"The image/x-canon-cr2 MIME type represents the Canon Raw Version 2 (CR2) file format. Introduced by Canon in 2004 with models like the EOS 1D Mark II and EOS 20D, CR2 replaced the earlier CRW format. It is a proprietary raw image format built on top of the standard TIFF specification. A CR2 file contains minimally processed, uncompressed or losslessly compressed (using lossless JPEG ITU-T81) pixel data directly from the camera's sensor. It also embeds EXIF metadata and usually two preview JPEGs (a small thumbnail and a high-resolution preview), allowing photographers maximum flexibility in post-processing exposure, white balance, and color grading without quality loss.","seo":{"title":"image/x-canon-cr2 MIME Type | Developer Reference for Canon CR2","description":"Complete reference for the image/x-canon-cr2 MIME type: Canon Raw Version 2 format, TIFF-based structure, raw sensor data, and file detection.","faqs":[{"question":"What is a CR2 file?","answer":"A CR2 file is a raw image file generated by Canon digital cameras. It contains raw, unprocessed sensor data, offering significantly higher dynamic range, detail, and color depth compared to a standard JPEG image."},{"question":"How do I open a CR2 file?","answer":"Because CR2 is a raw format, standard web browsers and basic image viewers cannot render it natively. You need specialized software like Adobe Lightroom, Adobe Photoshop (via Camera Raw), Capture One, or free alternatives like RawTherapee and darktable."},{"question":"What is the difference between CR2 and CR3?","answer":"CR3 is the successor to CR2, introduced by Canon in 2018. While CR2 is based on the TIFF file structure, CR3 is based on the ISO Base Media File Format (similar to MP4/HEIF) and introduces a new compressed raw option (C-RAW) that drastically reduces file size while maintaining high image quality."}]},"index":{"compression":["Lossless JPEG (ITU-T81)"],"browserSupport":{"score":1,"label":"None"},"commonUses":["Professional Digital Photography","Non-destructive Image Post-Processing","High Dynamic Range (HDR) Imaging Archival"]},"technical":{"magicBytes":{"hex":"49 49 2A 00 10 00 00 00 43 52 02 00","ascii":"II*.....CR.."},"container":"TIFF","compressionAlgorithm":["Lossless JPEG (ITU-T81)"],"colorDepth":["12-bit (Per Channel)","14-bit (Per Channel)"],"transparency":false,"animation":false,"metadata":{"exif":true,"xmp":true,"iccProfile":true},"alphaChannel":false,"progressiveLoading":false,"hdrSupport":true},"history":{"developer":"Canon Inc.","released":"2004","specification":"Proprietary (Reverse-engineered by the community / LibRaw)"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":false},"softwareSupport":[{"name":"Adobe Lightroom Classic / CC","logo":""},{"name":"Capture One","logo":""},{"name":"RawTherapee","logo":""},{"name":"ImageMagick","logo":"image-magic.webp"}],"conversion":{"convertTo":["dng","jpeg","tiff","png"],"convertFrom":[]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/x-canon-cr2"}],"htmlAccept":"image/x-canon-cr2, .cr2","fileDetection":["CR2 files begin with the standard TIFF little-endian magic bytes 'II*\\0' (Hex: 49 49 2A 00).","They are followed by a 4-byte integer offset to the first IFD (usually 0x00000010, Hex: 10 00 00 00).","The distinguishing CR2 signature 'CR\\x02\\x00' (Hex: 43 52 02 00) is located precisely at byte offset 8."]},"prosCons":{"pros":["Retains maximum sensor data, allowing extreme recovery of highlights and shadows that would be permanently lost in a JPEG","White balance and color profiling are not 'baked in', meaning they can be completely altered in post-production without degrading the image","Lossless compression ensures perfect pixel accuracy while reducing file size compared to fully uncompressed formats"],"cons":["Proprietary format means it requires constant updates to raw processing engines (like Adobe Camera Raw) every time Canon releases a new camera model","Produces very large file sizes (often 20MB to 40MB per image depending on sensor resolution)","Cannot be directly embedded into web pages or used in standard HTML/CSS contexts"]},"specifications":{"url":"http://lclevy.free.fr/cr2/","rfc":"","mimeAliases":["image/cr2"]},"developerSnippets":{"python":"import magic\n# Libmagic will reliably detect Canon CR2 by looking for the 'CR' signature inside the TIFF header\nprint(magic.from_file('photo.cr2', mime=True)) # Outputs 'image/x-canon-cr2'","nodejs":"const FileType = require('file-type');\nconst type = await FileType.fromFile('photo.cr2');\nconsole.log(type.mime); // Outputs 'image/x-canon-cr2'","go":"import (\n    \"bytes\"\n    \"net/http\"\n)\n// Native Go HTTP detection might only see the TIFF header and return 'image/tiff'.\n// You must explicitly check for the 'CR' signature at offset 8.\n// isCR2 := len(buf) \u003e 12 \u0026\u0026 bytes.Equal(buf[0:4], []byte{0x49, 0x49, 0x2A, 0x00}) \u0026\u0026 bytes.Equal(buf[8:12], []byte{0x43, 0x52, 0x02, 0x00})","php":"$mime = mime_content_type('photo.cr2');\necho $mime; // Standard PHP setups will resolve this to 'image/x-canon-cr2' if the magic database is up to date"},"relatedFormats":["cr3","crw","dng","tiff"]}
