-
Notifications
You must be signed in to change notification settings - Fork 490
Description
I try to extract thumb & preview image from a Nikon RAW file.
For my test i use a lot of file from this bank.
I analyze all the exif tag with exiftool and i found some important things, there is 3 jpg images inside.
ExifIFDO
The image in IFD0 (determined by Strip Offsets & Strip byte counts) is not a jpg file and seems empty (a lot of zero inside).
ExifSubIFD
Exif tool tell me there is a small JPEG inside.
--- Exif Tool out ---
Jpg From Raw Start : 1050112
Jpg From Raw Length : 1216696
Jpg From Raw : (Binary data 1216696 bytes, use -b option to extract)
When i compare with extracted data via metadata-extractor, i have two tags in this directory, with the same values, but this tag is unknown by metadata-extractor.
----Metadata out - Exif SubIFD-----
Unknown tag (0x0201) : 1050112
Unknown tag (0x0202) : 1216696
But the code 0x0201 & 0x0202 are used in other Directory by metadata-extractor, in the ExifThumbnailDirectory class
/**
* The offset to thumbnail image bytes, relative to the start of the IFD.
*
* To obtain the offset relative to the start of the TIFF data stream, use
* <code>getAdjustedThumbnailOffset</code>, which includes the value of
* <code>getExifStartOffset</code>.
*/
public static final int TAG_THUMBNAIL_OFFSET = 0x0201;
/**
* The size of the thumbnail image data in bytes.
*/
public static final int TAG_THUMBNAIL_LENGTH = 0x0202;
So i can retrieve this values in my ExifSubIFDDirectory with ExifThumbnail constants :
ExifSubIFDDirectory exifSubDir = ...
int offset = exifSubDir.getInt(ExifThumbnailDirectory.TAG_STRIP_OFFSETS);
int length = exifSubDir.getInt(ExifThumbnailDirectory.TAG_STRIP_BYTE_COUNTS);
Exif SubIFD Again
Yes, there are another dictionary with the same unknown tags (0x0201 & 0x0202).
I can extract it, cool.
-----Metadata out - Exif SubIFD----
New Subfile Type : Reduced-resolution image
Compression : JPEG (old-style)
X Resolution : 300 dots per inch
Y Resolution : 300 dots per inch
Resolution Unit : Inch
Unknown tag (0x0201) : 235520
Unknown tag (0x0202) : 814184
YCbCr Positioning : Datum point
Exif SubIFD Not a Jpg
i found another image, but it's not a jpg, maybe a tiff.
---- Metadata out - Exif SubIFD---
New Subfile Type : Full-resolution image
Image Width : 5584 pixels
Image Height : 3728 pixels
Bits Per Sample : 14 bits/component/pixel
Compression : Uncompressed
Photometric Interpretation : Color Filter Array
Strip Offsets : 2267136
Samples Per Pixel : 1 samples/pixel
Rows Per Strip : 3728 rows/strip
Strip Byte Counts : 41634304 bytes
X Resolution : 300 dots per inch
Y Resolution : 300 dots per inch
Planar Configuration : Chunky (contiguous for each subsampling pixel)
Resolution Unit : Inch
CFA Repeat Pattern Dim : 2 2
CFA Pattern : [Red,Green][Green,Blue]
Unknown tag (0x9217) : 2
And the preview?
Yes, exiftool tell me there are a PreviewIFD
---- ExitTool out - PreviewIFD ----
Compression : JPEG (old-style)
X Resolution : 300
Y Resolution : 300
Resolution Unit : inches
Preview Image Start : 52164
Preview Image Length : 124762
Y Cb Cr Positioning : Co-sited
Preview Image : (Binary data 124762 bytes, use -b option to extract)
Best