MRW Signature Format Specification & Recovery Example

MRW Camera Raw Signature Format: Specification & MRW Recovery Example

Konica Minolta MRW, a raw image file format used in Konica Minolta digital cameras. It stores data in an uncompressed format exactly as it was captured by the camera's sensor.

MRW Camera Raw files start with a signature MRM (hex: 4D 52 4D) at offset 1 (first byte (offset 0) is zero). At offset 4 there is a four-byte header length, big-endian format (highest byte first). At offset 24 (hex: 18) is a two-byte plane width (big-endian). At offset 26 (hex: 1A) is a two-byte plane heigth (big-endian). At offset 32 (hex: 20) is a one-byte plane's bits-per-pixel value. Total file size is calculated as: 8 + header_size + (plane_width * plane_heigth * plane_bits_per_pixel / 8).

Let's examine the example

When inspecting example.mrw file's text data using any Hex Viewer, like Active@ Disk Editor, which is included in Active@ File Recovery package, we can see it starts with a tag MRM (hex: 00, 4D, 52, 4D). Next to it, at offset 4, there is a 4-byte header size, which is 62,968 (hex: 00 00 F5 F8, big endian). Plane's width is 1,928, two bytes at offset 24 (hex: 07 88, big endian). Plane's height is 2,568, two bytes at offset 26 (hex: 0A 08, big endian). Plane's bits-per-pixel is 16, one byte at offset 32 (hex: 10). Total camera raw image file size is 9,965,184, which is: 8 + 62,968 + (1,928 * 2,568 * 16 / 8). Thus reading of all 9,965,184 consecutive bytes starting from the position of detected 0MRM header provide us with all MRW file data, provided that file is not fragmented.

MRW Camera Raw file - signature inspection

More info:

MRW files header:

offset size description
0 4 signature, must be 00 4D 52 4D hex (0x0"MRM")
4 4 header size (length of the following header), big-endian
24 2 raw image plane width, big-endian
26 2 raw image plane heigth, big-endian
32 1 raw image plane's bits per pixel

Active@ File Recovery Custom Scripting Example

This example just specifies MRW start signature and calculates file size based on camera raw image parameters.
Syntax of the signature definition language you can read here.

[MRW_HEADER]
DESCRIPTION=Minolta Camera Raw File
EXTENSION=mrw
BEGIN=MRW_BEGIN
SCRIPT=MRW_SCRIPT

[MRW_BEGIN]
\x00MRM=0|0

[MRW_SCRIPT]
	data = read(dword, 4)
	if (data == 0) goto exit
	width = read(word, 24)
	if (width == 0) goto exit
	width = endian(word, width)
	height = read(word, 26)
	if (height == 0) goto exit
	height = endian(word, height)
	pixel = read(byte, 32)
	if (pixel == 0) goto exit
	pixel = mul(pixel, width)
	pixel = mul(pixel, height)
	pixel = div(pixel, 8)
	size = endian(dword, data)
	size = sum(size, pixel)
	size = sum(size, 8)