Exif File Format
Exif File Format
Exif File Format
Japanese document
Referenced materials
Exif file format written by itojun (Japanese language document)
Exif file format written by Mamoru Ohno (Japanese language document)
TIFF6.0 Specification written by Adobe
TIFF/EP Specification written by ISO TC42 WG18
exifdump program written by Thierry Boush
DCF Specification written by ISO TC42 WG18
Exif2.1 Specification written by JEIDA
In JPEG format, some of Markers describe data, then SOS(Start of stream) Marker placed. After the SOS marker, JPEG
image stream starts and terminated by EOI Marker.
SOI Marker Marker XX size=SSSS
FFD8
Marker YY size=TTTT
Image
stream
FFXX SSSS DDDD...... FFYY TTTT DDDD...... FFDA UUUU DDDD.... I I I I....
EOI Marker
FFD9
FFE1
Other Marker
It starts from SOI(0xFFD8) Marker, so it's a JPEG file. Then APP1 Marker follows immediately. All the data of Exif are
stored in this APP1 data area. The part of "SSSS" on upper table means the size of APP1 data area (Exif data area).
Please notice that the size "SSSS" includes the size of descriptor itself also.
After the "SSSS", APP1 data starts. The first part is a special data to identify whether Exif or not, ASCII character "Exif"
and 2bytes of 0x00 are used.
After the APP1 Marker area, the other JPEG Markers follows.
FFE1
APP1 Marker
SSSS
45786966 0000
Exif Header
49492A00 08000000
TIFF Header
XXXX. . . .
LLLLLLLL
XXXX. . . .
XXXX. . . .
00000000
Directory
Link to IFD1
Directory
End of Link
XXXX. . . .
APP1 Data
XXXX. . . .
Interoperability IFD
00000000
XXXX. . . .
Directory
End of Link
XXXX. . . .
Makernote IFD
00000000
XXXX. . . .
Directory
End of Link
XXXX. . . .
IFD1(thumbnail image)
00000000
XXXX. . . .
FFD8XXXX. . . XXXXFFD9
Thumbnail image
Directory
End of Link
0x00000008
......
'TTTT'(2bytes) of above chart is Tag number, this shows a kind of data. 'ffff'(2bytes) is data format,
'NNNNNNNN'(4bytes) is number of components. 'DDDDDDDD'(4bytes) contains a data value or offset to data value.
Data format
Data format ('ffff' at the above chart) is defined as below. "rational" means a fractional value, it contains 2-signed/
unsigned long integer values, and the first represents the numerator, and the second, the denominator.
Value
Format
unsigned byte ascii strings unsigned short unsigned long unsigned rational signed byte
Bytes/component 1
Value
10
11
12
Format
undefined
double float
Bytes/component 1
You can get the total data byte length by multiplies a 'bytes/components' value (see above chart) by number of
components stored 'NNNNNNNN' area. If total data length is less than 4bytes, 'DDDDDDDD' contains the value of that
Tag. If its size is over 4bytes, 'DDDDDDDD' contains the offset to data stored address.
resolution of image.
Address 0x000c~0x000d is 0x0500, format of this value is unsigned rational(0x0005).
Address 0x000e~0x0011 is 0x01000000, number of components is '1'. Unsigned rational's data size is 8bytes/
components, so total data length is 1x8=8bytes.
Total data length is larger than 4bytes, so next 4bytes contains an offset to data.
Address 0x0012~0x0015 is 0x26000000, XResolution data is stored to address 0x0026
Address 0x0026~0x0029 is 0x48000000, numerator is 72, address 0x002a~0x002d is 0x0100000000,
denominator is '1'. So the value of XResoultion is 72/1.
Address0x0016~0x0017 is 0x6987, next Tag is ExifOffset(0x8769). Its value is an offset to Exif SubIFD
Data format is 0x0004, unsigned long integer.
This Tag has one component. Unsigned long integer's data size is 4bytes/components, so total data size is 4bytes.
Total data size is equal to 4bytes, next 4bytes contains the value of Exif SubIFD offset.
Address 0x001e~0x0021 is 0x11020000, Exif SubIFD starts from address '0x0211'.
This is the last directory entry, next 4bytes shows an offset to next IFD.
Address 0x0022~0x0025 is 0x40000000, next IFD starts from address '0x0040'
Thumbnail image
Exif format contains thumbnail of image (except Ricoh RDC-300Z). Usually it is located next to the IFD1. There are 3
formats for thumbnails; JPEG format(JPEG uses YCbCr), RGB TIFF format, YCbCr TIFF format. It seems that JPEG
format and 160x120 pixels of size are recommended thumbnail format for Exif2.1 or later. By the DCF specification,
thumbnail image MUST use JPEG format and image size is fixed to 160x120 pixels.
JPEG format thumbnail
If the value of Compression(0x0103) Tag in IFD1 is '6', thumbnail image format is JPEG. Most of Exif image uses JPEG
format for thumbnail. In that case, you can get offset of thumbnail from JpegIFOffset(0x0201) Tag in IFD1, size of
thumbnail from JpegIFByteCount(0x0202) Tag. Data format is ordinary JPEG format, starts from 0xFFD8 and ends by
0xFFD9.
TIFF format thumbnail
If the value of Compression(0x0103) Tag in IFD1 is '1', thumbnail image format is no compression(called TIFF image).
Start point of thumbnail data is StripOffset(0x0111) Tag, size of thumbnail is the sum of StripByteCounts(0x0117) Tag.
If thumbnail uses no compression and PhotometricInterpretation(0x0106)Tag in IFD1 has a value '2', thumbnail uses
RGB format. In that case, you can see thumbnail image by simply copy data to computer's RGB format(such as BMP
format, or copy to VRAM directory). Kodak DC-210/220/260 uses this format. Be mention that at TIFF stores pixel data
as 'RGB' order, but BMP stores 'BGR' order.
If that tag has a value '6', thumbnail uses YCbCr format. If you want to see thumbnail, you must convert it to RGB. Ricoh
RDC4200/4300, Fuji DS-7/300 and DX-5/7/9 use this format(newer RDC5000/MX-X00 series use JPEG). Next section
is brief description to conversion of Fuji DS's thumbnail. For more details, refer to TIFF6.0 specification.
At DX-5/7/9, YCbCrSubsampling(0x0212) has values of '2,1', PlanarConfiguration(0x011c) has a value '1'. So the data
align of this image is below.
Y(0,0),Y(1,0),Cb(0,0),Cr(0,0), Y(2,0),Y(3,0),Cb(2,0),Cr(3.0), Y(4,0),Y(5,0),Cb(4,0),Cr(4,0). . . .
The numeric in parenthesis is pixel coordinates. DX series' YCbCrCoefficients(0x0211) has values '0.299/0.587/0.114',
file:///C|/Program Files/Opanda/PowerExif 1.2/help/index-en-US.htm (6 of 25)11/3/2010 11:31:14 PM
ReferenceBlackWhite(0x0214) has values '0,255,128,255,128,255'. Therefore to convert from Y/Cb/Cr to RGB is;
B(0,0)=(Cb-128)*(2-0.114*2)+Y(0,0)
R(0,0)=(Cr-128)*(2-0.299*2)+Y(0,0)
G(0,0)=(Y(0,0)-0.114*B(0,0)-0.299*R(0,0))/0.587
Horizontal subsampling is a value '2', so you can calculate B(1,0)/R(1,0)/G(1,0) by using the Y(1,0) and Cr(0,0)/Cb(0,0).
Repeat this conversion by value of ImageWidth(0x0100) and ImageLength(0x0101).
Format
0x010e ImageDescription
ascii
string
0x010f
ascii
string
ascii
string
Make
0x0110 Model
0x0112 Orientation
CompoNo Desc.
unsigned
1
short
top
left side
top
right side
bottom
right side
bottom
left side
left side
top
left side
bottom
0x011a XResolution
unsigned
1
rational
0x011b YResolution
unsigned
1
rational
0x0128 ResolutionUnit
unsigned
1
short
0x0131 Software
ascii
string
0x0132 DateTime
ascii
string
0x013e WhitePoint
unsigned
2
rational
20
unsigned
PrimaryChromaticities
6
rational
unsigned
3
rational
unsigned
1
short
0x0214 ReferenceBlackWhite
unsigned
6
rational
0x8298 Copyright
ascii
string
0x8769 ExifOffset
unsigned
1
long
0x013f
0x0211 YCbCrCoefficients
0x0213 YCbCrPositioning
Tag Name
Format
CompoNo Desc.
0x829a ExposureTime
unsigned
1
rational
0x829d FNumber
unsigned
1
rational
0x8822 ExposureProgram
unsigned
1
short
0x8827 ISOSpeedRatings
unsigned
2
short
0x9000 ExifVersion
0x9003 DateTimeOriginal
0x9004 DateTimeDigitized
undefined 4
ascii
string
20
20
ascii
string
0x9102 CompressedBitsPerPixel
0x9201 ShutterSpeedValue
unsigned
1
rational
signed
rational
0x9202 ApertureValue
unsigned
1
rational
0x9203 BrightnessValue
signed
rational
signed
rational
0x9205 MaxApertureValue
unsigned
1
rational
0x9206 SubjectDistance
signed
rational
0x9207 MeteringMode
unsigned
1
short
0x9208 LightSource
unsigned
1
short
0x9209 Flash
unsigned
1
short
'0' means flash did not fire, '1' flash fired, '5' flash fired but
strobe return light not detected, '7' flash fired and strobe
return light detected.
0x920a FocalLength
unsigned
1
rational
0x927c MakerNote
undefined
0x9286 UserComment
undefined
0x9290 SubsecTime
ascii
string
0x9291 SubsecTimeOriginal
ascii
string
0x9292 SubsecTimeDigitized
ascii
string
0xa000 FlashPixVersion
undefined 4
0xa001 ColorSpace
unsigned
1
short
0xa002 ExifImageWidth
unsigned
1
short/long
0xa003 ExifImageHeight
unsigned
1
short/long
0xa004 RelatedSoundFile
ascii
string
0xa005 ExifInteroperabilityOffset
unsigned
1
long
0xa20e FocalPlaneXResolution
unsigned
1
rational
0xa20f FocalPlaneYResolution
unsigned
1
rational
unsigned
0xa210 FocalPlaneResolutionUnit
1
short
0xa215 ExposureIndex
unsigned
1
rational
0xa217 SensingMethod
unsigned
1
short
0xa300 FileSource
undefined 1
0xa301 SceneType
undefined 1
0xa302 CFAPattern
undefined
CFA
0
value
Format
CompoNo Desc.
0x0001 InteroperabilityIndex
Ascii string
0x0002 InteroperabilityVersion
Undefined
any
Short or
Long
0x1001 RelatedImageLength
Short or
Long
Format
CompoNo Desc.
0x0100 ImageWidth
unsigned short/long 1
0x0101 ImageLength
unsigned short/long 1
0x0102 BitsPerSample
unsigned short
0x0103 Compression
unsigned short
0x0111 StripOffsets
0x0115 SamplesPerPixel
unsigned short/long
unsigned short
unsigned short/long 1
0x0117 StripByteConunts
unsigned short/long
0x011a XResolution
unsigned rational
0x011b YResolution
unsigned rational
0x0116 RowsPerStrip
0x011c PlanarConfiguration
unsigned short
0x0128 ResolutionUnit
unsigned short
Unit of XResolution(0x011a)/YResolution
(0x011b). '1' means inch, '2' means centimeter.
0x0201 JpegIFOffset
unsigned long
0x0202 JpegIFByteCount
unsigned long
0x0211 YCbCrCoefficients
0x0212 YCbCrSubSampling
0x0213 YCbCrPositioning
0x0214 ReferenceBlackWhite
unsigned rational
unsigned short
unsigned short
unsigned rational
Misc Tags
Tag No. Tag Name
Format
CompoNo Desc.
0x00fe
NewSubfileType
unsigned long
0x00ff
SubfileType
unsigned short
0x012d TransferFunction
unsigned short
0x013b Artist
ascii string
0x013d Predictor
unsigned short
0x0142 TileWidth
unsigned short
0x0143 TileLength
unsigned short
0x0144 TileOffsets
unsigned long
0x0145 TileByteCounts
unsigned short
0x014a SubIFDs
unsigned long
0x015b JPEGTables
undefined
0x828d CFARepeatPatternDim
unsigned short
0x828e CFAPattern
unsigned byte
0x828f
unsigned rational 1
BatteryLevel
0x83bb IPTC/NAA
unsigned long
0x8773 InterColorProfile
undefined
0x8824 SpectralSensitivity
ascii string
0x8825 GPSInfo
unsigned long
0x8828 OECF
undefined
0x8829 Interlace
unsigned short
0x882a TimeZoneOffset
signed short
0x882b SelfTimerMode
unsigned short
0x920b FlashEnergy
unsigned rational 1
undefined
0x9211 ImageNumber
unsigned long
0x9212 SecurityClassification
ascii string
0x9213 ImageHistory
ascii string
0x9214 SubjectLocation
unsigned short
0x9215 ExposureIndex
unsigned rational 1
0x9216 TIFF/EPStandardID
unsigned byte
0xa20b FlashEnergy
unsigned rational 1
4
4
0xa214 SubjectLocation
unsigned short
Format
OLYMP...........
................
CompoNo Value
0x0200 SpecialMode
Unsigned Long
0x0201 JpegQual
Unsigned Short
0x0202 Macro
Unsigned Short
0x0203 Unknown
Unsigned Short
Unknown
0x0204 DigiZoom
Unsigned Rational 1
0x0205 Unknown
Unsigned Rational 1
Unknown
0x0206 Unknown
Signed Short
Unknown
0x0208 PictInfo
Ascii string
52
0x0209 CameraID
Undefined
32
0x0f00
Unsigned Long
30
Unknown
DataDump
Format
CompoNo Value
0x0002 Unknown
Ascii string
0x0003 Quality
Unsigned short
Unsigned short
1:Color, 2:Monochrome.
Unsigned short
Unsigned short
0x0008 Focus
Unsigned rational 1
0x0009 Unknown
Ascii string
Unknown
Unsigned rational 1
0x000b Converter
Unsigned short
0x0f00
Unsigned long
25~30
Unknown
Unknown
20
At E990, there is no Ascii string. As like the usual IFD (e.g. IFD0, SubIFD), IFD starts from the first byte of data. Nikon
D1 also uses this format. Example of actual data structure is shown below.
:0000: 10 00 01 00 07 00 04 00-00 00 00 01 00 00 02 00
:0010: 03 00 02 00 00 00 00 00-64 00 03 00 02 00 06 00
................
........d.......
Format
CompoNo Value
0x0001 Unknown
Undefined
Unsigned short
0,100=ISO 100
0,200=ISO200
0,400=ISO400
etc.
Ascii string
varies
"COLOR", "B&W"
0x0004 Quality
Ascii string
varies
0x0005 Whitebalance
Ascii string
varies
Ascii string
varies
Ascii string
varies
Ascii string
varies
0x000a Unknown
Unsigned rational 1
Ascii string
varies
Ascii string
varies
0x0082 Adapter
Ascii string
varies
0x000f
ISO Selection
Unsigned rational 1
Undefined
Undefined
174
Unknown.
Format
CompoNo Value
0x0002 Quality
Unsigned Short 1
Unsigned Short 1
Unsigned Short 1
Unsigned Short 1
0x0008 Unknown
Unsigned short 1
Unknown
0x0009 Unknown
Unsigned short 1
Unknown
Unsigned Long 1
0x000b Sharpness
Unsigned Short 1
0x000c Contrast
Unsigned Short 1
0x000d Saturation
Unsigned Short 1
0x000e Unknown
Unsigned short 1
Unknown
0x000f
Unknown
Unsigned short 1
Unknown
0x0010 Unknown
Unsigned short 1
Unknown
0x0011 Unknown
Unsigned long 1
Unknown
0x0012 Unknown
Unsigned short 1
Unknown
0x0013 Unknown
Unsigned short 1
Unknown
QV3000: 64:Normal, 125:+1.0, 250:+2.0, 244:+3.0
QV8000/2000: 80:Normal, 100:High
Fujifilm's Exif data uses Motorola align, but MakerNote ignores it and uses Intel align.
The other manufacturer's MakerNote counts the "offset to data" from the first byte of TIFF header (same as the
other IFD), but Fujifilm counts it from the first byte of MakerNote itself.
I think it's a BUG, but it can't be helped now... The data below is analyzed at Fujifilm FinePix4900Z.
Format
CompoNo Value
0x0000 Version
Undefined
0x1000 Quality
Ascii string
0x1001 Sharpness
Unsigned Short 1
Unsigned Short 1
0x1003 Color
Unsigned Short 1
0x1004 Tone
Unsigned Short 1
Unsigned Short 1
Signed Rational 1
0x1020 Macro
Unsigned Short 1
Unsigned short 1
0x1030 SlowSync.
Unsigned short 1
Unsigned short 1
0x1032 unknown
Unsigned Short 1
Unknown
0x1200 unknown
Unsigned Short 1
Unknown
Unsigned Short 1
Unsigned short 1
0x1302 AE warning
Unsigned short 1
Tag Name
Unknown
Format
Unsigned
Short
CompoNo
6
Value
Always 0
Offset
within tag
Meaning
Macro mode
unknown
1: macro
2: normal
Flash mode
Continuous drive
mode
unknown
Focus Mode
8, 9
unknown
0: One-Shot
1: AI Servo
2: AI Focus
3: MF
4: Single (but check field 32)
5: Continuous
6: MF
Image size
0: large
1: medium
2: small
11
"Easy shooting"
mode
0: Full Auto
1: Manual
2: Landscape
3: Fast Shutter
4: Slow Shutter
5: Night
6: B&W
7: Sepia
8: Portrait
9: Sports
10: Macro / Close-Up
11: Pan Focus
12
unknown
10
0x1
Unknown
Unsigned
Short
varies
13
Contrast
0xffff: low
0x0000: normal
0x0001: high
14
Saturation
0xffff: low
0x0000: normal
0x0001: high
15
Sharpness
0xffff: low
0x0000: normal
0x0001: high
ISO
If zero, use
ISOSpeedRatings EXIF tag
instead
15: auto
16: 50
17: 100
18: 200
19: 400
17
Metering mode
3: Evaluative
4: Partial
5: Center-weighted
18
unknown
16
AF point selected
20
Exposure mode
21, 22
unknown
23
24
25
26 - 28
unknown
19
29
Flash details
30 - 31
unknown
Bits 15..0:
14: external E-TTL
13: internal flash
11: FP sync used
4: FP sync enabled
other bits unknown
32
0x3
Unknown
Unsigned
Short
Focus mode
unknown
Offset
within tag
Unknown
Unsigned
Short
Meaning
1-6
unknown
0: auto
1: Sunny
2: Cloudy
3: Tungsten
4: Flourescent
5: Flash
6: Custom
White balance
unknown
10 - 13
unknown
14
0x4
AF point used
varies
15
Flash bias
0x0030: 1.50 EV
0x0034: 1.67 EV
0x0040: 2 EV
16 - 18
19
unknown
Subject
Distance
0x6
Image type
Ascii string
32
0x7
Firmware
version
Ascii string
24
0x8
Image Number
Unsigned
Long
0x9
Owner name
Ascii string
32
0xa
Unknown
Unsigned
Short
varies
unknown
0xc
Camera serial
number
Unsigned
Long
0xd
Unknown
Unsigned
Short
varies
unknown
varies
First short is the number of bytes in the tag (i.e. twice the
number of shorts)
For each other value: the top 8 bits are the C.Fn number, and the
lower 8 bits are the value.
0xf
Custom
Functions
Unsigned
Short
Name
Value
0: Off
1: On
Shutter/AE-lock buttons
0: AF/AE lock
1: AE lock/AF
2: AF/AF lock
3: AE+release/AE+AF
Mirror lockup
0: Disable
1: Enable
0: 1/2 stop
1: 1/3 stop
AF-assist light
0: On (auto)
1: Off
0: Automatic
1: 1/200 (fixed)
AEB sequence/auto
cancellation
0: 0, -, + / Enabled
1: 0, -, + / Disabled
2: -, 0, + / Enabled
3: -, 0, + / Disabled
0: 1st-curtain sync
1: 2nd-curtain sync
0: AF stop
1: Operate AF
Lens AF stop button Fn. Switch
2: Lock AE and start
timer
10
0: Enable
1: Disable
0: Top
1: Previous (volatile)
2: Previous
12
0: Not assigned
1: Change quality
2: Change ISO speed
3: Select parameters
13
Sensor cleaning
0: Disable
1: Enable
11
History
rev. 1.4
rev. 1.3
rev. 1.2
rev. 1.1
rev. 1.0
First release
Acknowledgement
I would like to thank to;
Daniel Switkin: Byte align of TAG Mark, Format of ImageWidth/ImageLength
Peter Esherick: MakerNote of Olympus
Matthias Wandel: Value of FocalPlaneResolutionUnit
Max Lyons: Makernote of Nikon ...His webpage
Eckhard Henkel: Makernote of Casio ...His webpage
David Burren: FocalPlaneResolutionUnit of Fujifilm's / Makernote of Canon ...His webpage