How to get Raw data from CR2 format. page5 - IFD1 and IFD2

since:Aug 31,2014
last update:Sep 6,2014
previous page : next page

> > >



3.6 IFD1

IFD1 starts from the address 0x0000 B5D0 which is stored after the end of IFD0.
Below is the result of parsing IFD1 by exiftool (command option -v3)


  + [IFD1 directory with 2 entries]
  | 0)  ThumbnailOffset = 55048
  |     - Tag 0x0201 (4 bytes, int32u[1]):
  |         b5da: 08 d7 00 00                                     [....]
  | 1)  ThumbnailLength = 3424
  |     - Tag 0x0202 (4 bytes, int32u[1]):
  |         b5e6: 60 0d 00 00  

There are tha address of thumbnail image and its length in this IFD.

The address to IFD2 0x0000 B5EE is stored after the end of IFD1.

3.7 IFD2

IFD2 starts from the address 0x0000 B5EE.
Below is the result of parsing IFD2 by exiftool (command option -v3) .


  + [IFD2 directory with 13 entries]
  | 0)  ImageWidth = 668
  |     - Tag 0x0100 (2 bytes, int16u[1]):
  |         b5f8: 9c 02                                           [..]
  | 1)  ImageHeight = 432
  |     - Tag 0x0101 (2 bytes, int16u[1]):
  |         b604: b0 01                                           [..]
  | 2)  BitsPerSample = 16 16 16
  |     - Tag 0x0102 (6 bytes, int16u[3]):
  |         b690: 10 00 10 00 10 00                               [......]
  | 3)  Compression = 1
  |     - Tag 0x0103 (2 bytes, int16u[1]):
  |         b61c: 01 00                                           [..]
  | 4)  PhotometricInterpretation = 2
  |     - Tag 0x0106 (2 bytes, int16u[1]):
  |         b628: 02 00                                           [..]
  | 5)  StripOffsets = 677216
  |     - Tag 0x0111 (4 bytes, int32u[1]):
  |         b634: 60 55 0a 00                                     [`U..]
  | 6)  SamplesPerPixel = 3
  |     - Tag 0x0115 (2 bytes, int16u[1]):
  |         b640: 03 00                                           [..]
  | 7)  RowsPerStrip = 432
  |     - Tag 0x0116 (2 bytes, int16u[1]):
  |         b64c: b0 01                                           [..]
  | 8)  StripByteCounts = 1731456
  |     - Tag 0x0117 (4 bytes, int32u[1]):
  |         b658: 80 6b 1a 00                                     [.k..]
  | 9)  PlanarConfiguration = 1
  |     - Tag 0x011c (2 bytes, int16u[1]):
  |         b664: 01 00                                           [..]
  | 10) Exif_0xc5d9 = 2
  |     - Tag 0xc5d9 (4 bytes, int32u[1]):
  |         b670: 02 00 00 00                                     [....]
  | 11) Exif_0xc6c5 = 3
  |     - Tag 0xc6c5 (4 bytes, int32u[1]):
  |         b67c: 03 00 00 00                                     [....]
  | 12) Exif_0xc6dc = 649 432 19 0
  |     - Tag 0xc6dc (16 bytes, int32u[4]):
  |         b696: 89 02 00 00 b0 01 00 00 13 00 00 00 00 00 00 00 [................]

This IFD has many informations for the small image which is uncompressed 16bit-color depth image.
In the sample, the start address of image data is 0x000A 5560.(entry #5)

Below is dump of image data.



Each data per 2 bytes means red, green and blue value. That is, the first pixel is as follows:
Red value :0x0806
Green value : 0x07FF
Blue value : 0x07FF

This samall image is used in DPP's histogram and small image of tool pallet.
(DPP (Digital Photo Professional) is the application provided by Canon).

If you would like to decode the raw data and transfer to a viewable image format, you should not consider this. However, if you would like to encode or to rewrite into CR2 format, you should.

The address to IFD3 0x0000 B6A6 is stored after the end of IFD2 like other IFD.
This address is same as the address in the file header.


next page : IFD3 and Raw data

previous page [1] [2] [3] [4] [5] [6] [7] [8] [9] next page