Canon digital camera RAW file
image/x-raw-canon
Magic Bytes
Offset: 0
49 49 1A 00 00 00 48 45 41 50 43 43 44 52
Canon Raw (CRW) is a proprietary image file format developed by Canon Inc. to store unprocessed sensor data from its early digital cameras. It captures raw pixel information and metadata, allowing photographers to perform non-destructive editing and post-processing adjustments in specialized software. Although historically significant as a digital negative, this format follows the Camera Image File Format (CIFF) specification and is now largely superseded by newer standards like CR2 and CR3.
Validation Code
How to validate .crw files in Python
Python
def is_crw(file_path: str) -> bool:
"""Check if file is a valid CRW by magic bytes."""
signature = bytes([0x49, 0x49, 0x1A, 0x00, 0x00, 0x00, 0x48, 0x45, 0x41, 0x50, 0x43, 0x43, 0x44, 0x52])
with open(file_path, "rb") as f:
return f.read(14) == signature
How to validate .crw files in Node.js
Node.js
function isCRW(buffer: Buffer): boolean {
const signature = Buffer.from([0x49, 0x49, 0x1A, 0x00, 0x00, 0x00, 0x48, 0x45, 0x41, 0x50, 0x43, 0x43, 0x44, 0x52]);
return buffer.subarray(0, 14).equals(signature);
}
Go
func IsCRW(data []byte) bool {
signature := []byte{0x49, 0x49, 0x1A, 0x00, 0x00, 0x00, 0x48, 0x45, 0x41, 0x50, 0x43, 0x43, 0x44, 0x52}
if len(data) < 14 {
return false
}
return bytes.Equal(data[:14], signature)
}
API Endpoint
GET
/api/v1/crw
curl https://filesignature.org/api/v1/crw