Project

General

Profile

Bug #1286

Unable to extract ICC profile from Leica Image

Added by Robin Mills over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
jpeg parser
Target version:
Start date:
05 Apr 2017
Due date:
% Done:

100%

Estimated time:
2.00 h

Description

639 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -eC ~/Downloads/leica_q_typ_116_01.jpg 
Exiv2 exception in extract action for file /Users/rmills/Downloads/leica_q_typ_116_01.jpg:
Not a valid ICC Profile
640 rmills@rmillsmbp:~/gnu/exiv2/trunk $

Files

leica_q_typ_116_01.jpg (11.4 MB) leica_q_typ_116_01.jpg Robin Mills, 05 Apr 2017 18:29
dmpf.cpp (1.46 KB) dmpf.cpp Robin Mills, 05 Apr 2017 18:29

Associated revisions

Revision 4752 (diff)
Added by Robin Mills over 4 years ago

#1286 Fix submitted.

Revision 4753 (diff)
Added by Robin Mills over 4 years ago

#1286 Correction to r4752

History

#1

Updated by Robin Mills over 4 years ago

619 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pS ~/Downloads/leica_q_typ_116_01.jpg 
STRUCTURE OF JPEG FILE: /Users/rmills/Downloads/leica_q_typ_116_01.jpg
 address | marker       |  length | data
       0 | 0xffd8 SOI  
       2 | 0xffe1 APP1  |   48508 | Exif..II*......................
   48512 | 0xffe2 APP2  |    3200 | ICC_PROFILE......HLino....mntrRG chunk 1/1
   51714 | 0xffdb DQT   |     132 
   51848 | 0xffc0 SOF0  |      17 
   51867 | 0xffc4 DHT   |     418 
   52287 | 0xffdd DRI   |       4 
   52293 | 0xffda SOS
620 rmills@rmillsmbp:~/gnu/exiv2/trunk $ dd bs=1 count=$((3200-16)) skip=$((48512+16)) if=~/Downloads/leica_q_typ_116_01.jpg > foo.icc
3184+0 records in
3184+0 records out
3184 bytes (3.2 kB) copied, 0.011329 s, 281 kB/s
621 rmills@rmillsmbp:~/gnu/exiv2/trunk $ dmpf foo.icc | head -1
       0        0: .....HLino....mn  ->  01 01 00 00 0c  H  L  i  n  o 02 10 00 00  m  n
622 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 
dmpf is my home made dump utility (od on steroids, code is attached).

The 'Lino' string makes me think 'Linotype' as the makers of the profile. Here’s an Adobe profile in our test suite:

630 rmills@rmillsmbp:~/gnu/exiv2/trunk $ dmpf test/data/small.icc  | head -1
       0        0: ...0ADBE....mntr  ->  00 00 02  0  A  D  B  E 02 10 00 00  m  n  t  r
631 rmills@rmillsmbp:~/gnu/exiv2/trunk $

Conclusion: There are two ‘0x01’ bytes in the Leica image that look suspicious. If we ignore them, we have the big endian length as 0x00 00 0c 48 = 3144. Getting excited:

637 rmills@rmillsmbp:~/gnu/exiv2/trunk $ dd bs=1 count=$((3200-16)) skip=$((48512+18)) if=~/Downloads/leica_q_typ_116_01.jpg > foo.icc
3184+0 records in
3184+0 records out
3184 bytes (3.2 kB) copied, 0.0118 s, 270 kB/s
638 rmills@rmillsmbp:~/gnu/exiv2/trunk $ iccDumpProfile foo.icc 
Profile:          'foo.icc'
Profile ID:       Profile ID not calculated.
Size:             3144(0xc48) bytes

Header
------
Attributes:       Reflective | Glossy
Cmm:              Unknown 'Lino' = 4C696E6F
Creation Date:    2/9/1998  06:49:00
….
              greenTRCTag  'gTRC'      1084        2060
               blueTRCTag  'bTRC'      1084        2060
639 rmills@rmillsmbp:~/gnu/exiv2/trunk $

#2

Updated by Robin Mills over 4 years ago

Fix submitted. r4752

The profile in the leica test file is padded. The JPEG has allocated 3200 bytes, however the "real" profile length is 3144 bytes. The first four bytes of a profile are the length of the profile encoded as big-endian. Those four bytes give us the correct size of the profile.

#3

Updated by Robin Mills over 4 years ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF