{"success":true,"data":{"ext":"cr2","name":"Canon digital camera RAW file","description":"Canon Digital Camera RAW (CR2) is a raw image file format developed by Canon for its digital cameras and based on the TIFF standard. It is used to store unprocessed sensor data for photography workflows, including professional editing, color correction, and long-term image archiving in software such as Canon utilities and third-party raw processors. The format is generally considered safe, though like other image files it should be opened with updated software.","mime":["image/x-canon-cr2"],"risk_level":"Safe","signatures":[{"hex":"4D 4D 00 2A","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"49 49 2A 00","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"4D 4D 00 2B","offset":0,"sources":[{"name":"Apache Tika","url":"https://raw.githubusercontent.com/apache/tika/main/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml"}]},{"hex":"49 49 2A 00 10 00 00 00","offset":0,"sources":[{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"}]},{"hex":"43 52","offset":0,"sources":[{"name":"Wikipedia","url":"https://en.wikipedia.org/wiki/List_of_file_signatures"}]},{"hex":"49 49 2A 00 10 00 00 00 43 52","offset":0,"sources":[{"name":"Gary Kessler","url":"https://www.garykessler.net/library/file_sigs_GCK_latest.html"}]}],"related":["tif","jpg","avif","bmp","cr3","dib"],"usage":{"python":"def is_cr2(file_path: str) -> bool:\n    \"\"\"Check if file is a valid CR2 by magic bytes.\"\"\"\n    signature = bytes([0x4D, 0x4D, 0x00, 0x2A])\n    with open(file_path, \"rb\") as f:\n        return f.read(4) == signature","node":"function isCR2(buffer: Buffer): boolean {\n  const signature = Buffer.from([0x4D, 0x4D, 0x00, 0x2A]);\n  return buffer.subarray(0, 4).equals(signature);\n}","go":"func IsCR2(data []byte) bool {\n    signature := []byte{0x4D, 0x4D, 0x00, 0x2A}\n    if len(data) < 4 {\n        return false\n    }\n    return bytes.Equal(data[:4], signature)\n}"},"category":"Images"}}