Bug 182013

Summary: sensitivity is not shown for rw2 files
Product: [Applications] digikam Reporter: S. Burmeister <sven.burmeister>
Component: Metadata-RawAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahuggel, caulier.gilles, matze
Priority: NOR    
Version: 0.10.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 7.0.0
Sentry Crash Report:
Attachments: sensible information for RW2 files
drop JPEG engine tags on rw2 files

Description S. Burmeister 2009-01-26 19:36:31 UTC
Version:           0.10 svn Rev: 916863 (using KDE 4.1.96)
OS:                Linux
Installed from:    SuSE RPMs

For rw2 pictures the sensitivity is not shown (unavailable), neither is the lens, yet I am not sure it actually exists. The ISO does however exist.

dcraw -i -v p1000209.rw2 fel/Bilder/Private Photos/2009-01-06 Bochum hin und zurü

Filename: p1000209.rw2
Timestamp: Tue Jan  6 12:36:57 2009
Camera: Panasonic DMC-LX3
ISO speed: 80
Shutter: 1/1600.0 sec
Aperture: f/8.0
Focal length: 12.8 mm
Embedded ICC profile: no
Number of raw images: 1
Thumb size:  1920 x 1440
Full size:   3724 x 2754
Image size:  3724 x 2754
Output size: 3724 x 2754
Raw colors: 3
Filter pattern: RGGBRGGBRGGBRGGB
Daylight multipliers: 1.000000 1.000000 1.000000
Camera multipliers: 502.000000 263.000000 451.000000 0.000000

digiKam version 0.10.0-rc2 (rev.: 917021)
Exiv2 can write to Jp2: Yes
Exiv2 can write to Jpeg: Yes
Exiv2 can write to Png: Yes
Exiv2 can write to Tiff: Yes
Exiv2 support XMP metadata: Yes
LibCImg: 129
LibExiv2: 0.18
LibJPEG: 62
LibJasper: 1.900.1
LibKDE: 4.1.96 (KDE 4.1.96 (KDE 4.2 RC1)) "release 78.1"
LibKExiv2: 0.5.0
LibKdcraw: 0.4.0
LibLCMS: 117
LibPNG: 1.2.26
LibQt: 4.4.3
LibRaw: 0.6.11-Release
LibTIFF: LIBTIFF, Version 3.8.2 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.
Marble widget: pre 0.7 SVN
LibGphoto2: 2.4.1.2
LibKipi: 0.3.0
Comment 1 caulier.gilles 2009-01-26 20:19:04 UTC
metadata are extracted using Exiv2, not dcraw.

Look how exiv2 command line tool work...

Gilles Caulier
Comment 2 S. Burmeister 2009-01-26 20:31:32 UTC
exiv2 pr p1000209.rw2 ate Photos/2009-01-06 Bochum hin und zurü
Warning: Directory Image, entry 0x0111: Strip 0 is outside of the data area; ignored.
File name       : p1000209.rw2
File size       : 12335616 Bytes
MIME type       : image/x-raw
Image size      : 3656 x 2742
Camera make     : Panasonic
Camera model    : DMC-LX3
Image timestamp : 2009:01:06 12:36:57
Image number    :
Exposure time   : 1/1600 s
Aperture        : F8
Exposure bias   : 0 EV
Flash           : No, compulsory
Flash bias      :
Focal length    : 12.8 mm
Subject distance:
ISO speed       :
Exposure mode   : Auto
Metering mode   : Multi-segment
Macro mode      :
Image quality   :
Exif Resolution :
White balance   :
Thumbnail       : None
Copyright       :
Exif comment    :
Comment 3 S. Burmeister 2009-01-26 20:33:22 UTC
I just noticed, why are the image sizes shown by dcraw and exiv2 not the same?
Comment 4 Matthias Welwarsky 2009-01-27 11:05:51 UTC
(In reply to comment #2)
Does libexiv2 v0.18 even support rw2 files fully? I had to pull a very recent version from svn to make it work (I'm using a Pana DMC-G1).
Comment 5 caulier.gilles 2009-01-27 11:14:15 UTC
No. Exiv2 0.18 do not support RW2. Only current code from svn support it (included in next Exiv2 release)

Gilles Caulier
Comment 6 Andreas Huggel 2009-01-27 11:56:20 UTC
Re comment #3: Which one is correct? Can you show the output of exiv2 -pa too?

-ahu.
Comment 7 S. Burmeister 2009-01-27 12:51:22 UTC
exiv2 -pa p1000209.rw2 
Warning: Directory Image, entry 0x0111: Strip 0 is outside of the data area; ignored.                            
Exif.Image.0x0001                            Undefined   4  48 51 49 48                                          
Exif.Image.0x0002                            Short       1  3724                                                 
Exif.Image.0x0003                            Short       1  2754                                                 
Exif.Image.0x0004                            Short       1  6                                                    
Exif.Image.0x0005                            Short       1  8                                                    
Exif.Image.0x0006                            Short       1  2742                                                 
Exif.Image.0x0007                            Short       1  3656                                                 
Exif.Image.0x0008                            Short       1  1                                                    
Exif.Image.0x0009                            Short       1  4                                                    
Exif.Image.0x000a                            Short       1  12                                                   
Exif.Image.ProcessingSoftware                Short       1  34316                                                
Exif.Image.0x000d                            Short       1  1                                                    
Exif.Image.0x000e                            Short       1  4095                                                 
Exif.Image.0x000f                            Short       1  4095                                                 
Exif.Image.0x0010                            Short       1  4095                                                 
Exif.Image.0x0017                            Short       1  80                                                   
Exif.Image.0x0018                            Short       1  0                                                    
Exif.Image.0x0019                            Short       1  0                                                    
Exif.Image.0x001a                            Short       1  0                                                    
Exif.Image.0x001b                            Undefined  26  3 0 100 0 1 0 1 0 1 0 200 0 2 0 2 0 2 0 144 1 4 0 4 0 4 0 
Exif.Image.0x001c                            Short       1  0                                                         
Exif.Image.0x001d                            Short       1  0                                                         
Exif.Image.0x001e                            Short       1  0                                                         
Exif.Image.0x0024                            Short       1  502                                                       
Exif.Image.0x0025                            Short       1  263                                                       
Exif.Image.0x0026                            Short       1  451                                                       
Exif.Image.0x0027                            Undefined  58  7 0 9 0 242 1 0 1 177 1 10 0 34 2 0 1 148 1 11 0 95 2 0 1 117 1 3 0 79 1 0 1 93 2 4 0 52 2 0 1 138 1 20 0 1 2 0 1 182 1 24 0 79 1 0 1 93 2                                                        
Exif.Image.0x002d                            Short       1  4                                                                  
Exif.Image.0x002e                            Undefined 603136  (Binäre Werte sind unterdrückt)                                 
Exif.Image.Make                              Ascii      10  Panasonic                                                          
Exif.Image.Model                             Ascii       8  DMC-LX3                                                            
Exif.Image.StripOffsets                      Long        1  4294967295                                                         
Exif.Image.Orientation                       Short       1  oben - links                                                       
Exif.Image.RowsPerStrip                      Short       1  2754                                                               
Exif.Image.StripByteCounts                   Long        1  20511792                                                           
Exif.Image.0x0118                            Long        1  604672                                                             
Exif.Image.0x0119                            Undefined  32  51 164 85 132 119 0 0 0 239 255 0 0 120 2 1 0 123 2 103 0 1 1 72 0 232 8 91 2 240 60 17 106                                                                                                       
Exif.Image.XResolution                       Short       1  1                                                                  
Exif.Image.YResolution                       Undefined  64  91                                                                 
Exif.Image.ExifTag                           Long        1  708                                                                
Exif.Photo.ExposureTime                      Rational    1  1/1600 s                                                           
Exif.Photo.FNumber                           Rational    1  F8                                                                 
Exif.Photo.ExposureProgram                   Short       1  Automatisch                                                        
Exif.Photo.ExifVersion                       Undefined   4  2.21                                                               
Exif.Photo.DateTimeOriginal                  Ascii      20  2009:01:06 12:36:57                                                
Exif.Photo.DateTimeDigitized                 Ascii      20  2009:01:06 12:36:57                                                
Exif.Photo.ExposureBiasValue                 SRational   1  0 EV                                                               
Exif.Photo.MaxApertureValue                  Rational    1  F2                                                                 
Exif.Photo.MeteringMode                      Short       1  Mehr-Segment                                                       
Exif.Photo.Flash                             Short       1  Blitz nicht ausgelöst, festgelegter Modus                          
Exif.Photo.FocalLength                       Rational    1  12.8 mm                                                            
Exif.Photo.FileSource                        Undefined   1  Digitalkamera                                                      
rabauke@linux-fpxk:/media/Bueffel/Bilder/Private Photos/2009-01-06 Bochum hin und zurück> export LANG=en_US.UTF-8
rabauke@linux-fpxk:/media/Bueffel/Bilder/Private Photos/2009-01-06 Bochum hin und zurück> exiv2 -pa p1000209.rw2 
Warning: Directory Image, entry 0x0111: Strip 0 is outside of the data area; ignored.                            
Exif.Image.0x0001                            Undefined   4  48 51 49 48                                          
Exif.Image.0x0002                            Short       1  3724                                                 
Exif.Image.0x0003                            Short       1  2754                                                 
Exif.Image.0x0004                            Short       1  6                                                    
Exif.Image.0x0005                            Short       1  8                                                    
Exif.Image.0x0006                            Short       1  2742                                                 
Exif.Image.0x0007                            Short       1  3656                                                 
Exif.Image.0x0008                            Short       1  1                                                    
Exif.Image.0x0009                            Short       1  4                                                    
Exif.Image.0x000a                            Short       1  12                                                   
Exif.Image.ProcessingSoftware                Short       1  34316                                                
Exif.Image.0x000d                            Short       1  1                                                    
Exif.Image.0x000e                            Short       1  4095                                                 
Exif.Image.0x000f                            Short       1  4095                                                 
Exif.Image.0x0010                            Short       1  4095                                                 
Exif.Image.0x0017                            Short       1  80                                                   
Exif.Image.0x0018                            Short       1  0                                                    
Exif.Image.0x0019                            Short       1  0
Exif.Image.0x001a                            Short       1  0
Exif.Image.0x001b                            Undefined  26  3 0 100 0 1 0 1 0 1 0 200 0 2 0 2 0 2 0 144 1 4 0 4 0 4 0
Exif.Image.0x001c                            Short       1  0
Exif.Image.0x001d                            Short       1  0
Exif.Image.0x001e                            Short       1  0
Exif.Image.0x0024                            Short       1  502
Exif.Image.0x0025                            Short       1  263
Exif.Image.0x0026                            Short       1  451
Exif.Image.0x0027                            Undefined  58  7 0 9 0 242 1 0 1 177 1 10 0 34 2 0 1 148 1 11 0 95 2 0 1 117 1 3 0 79 1 0 1 93 2 4 0 52 2 0 1 138 1 20 0 1 2 0 1 182 1 24 0 79 1 0 1 93 2
Exif.Image.0x002d                            Short       1  4
Exif.Image.0x002e                            Undefined 603136  (Binary value suppressed)
Exif.Image.Make                              Ascii      10  Panasonic
Exif.Image.Model                             Ascii       8  DMC-LX3
Exif.Image.StripOffsets                      Long        1  4294967295
Exif.Image.Orientation                       Short       1  top, left
Exif.Image.RowsPerStrip                      Short       1  2754
Exif.Image.StripByteCounts                   Long        1  20511792
Exif.Image.0x0118                            Long        1  604672
Exif.Image.0x0119                            Undefined  32  51 164 85 132 119 0 0 0 239 255 0 0 120 2 1 0 123 2 103 0 1 1 72 0232 8 91 2 240 60 17 106
Exif.Image.XResolution                       Short       1  1
Exif.Image.YResolution                       Undefined  64  91
Exif.Image.ExifTag                           Long        1  708
Exif.Photo.ExposureTime                      Rational    1  1/1600 s
Exif.Photo.FNumber                           Rational    1  F8
Exif.Photo.ExposureProgram                   Short       1  Auto
Exif.Photo.ExifVersion                       Undefined   4  2.21
Exif.Photo.DateTimeOriginal                  Ascii      20  2009:01:06 12:36:57
Exif.Photo.DateTimeDigitized                 Ascii      20  2009:01:06 12:36:57
Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
Exif.Photo.MaxApertureValue                  Rational    1  F2
Exif.Photo.MeteringMode                      Short       1  Multi-segment
Exif.Photo.Flash                             Short       1  No, compulsory
Exif.Photo.FocalLength                       Rational    1  12.8 mm
Exif.Photo.FileSource                        Undefined   1  Digital still camera
Comment 8 caulier.gilles 2009-01-27 13:08:25 UTC
dcraw repport a lots of possible image sizes from metadata:

Thumb size: 1920 x 1440 

The jpeg preview image embeded in RAW.

Full size: 3724 x 2754 
Image size: 3724 x 2754 
Output size: 3724 x 2754

Here these values are the same, but can be different between camera model.

dcraw take a care of frame abound RAW data image. Some pixels lines are not used around CCD sensor, for technical reasons. This is why you can see 3 image sizes.

Gilles Caulier
Comment 9 Andreas Huggel 2009-01-27 14:50:13 UTC
exiv2 -pp should also report the thumbnail image (with -ep you can extract it)

There are two pairs of tags in the Panasonic images which look like size tags, but I'm not yet sure what exactly they mean:

Exif.Image.0x0002 Short 1 3724
Exif.Image.0x0003 Short 1 2754

and

Exif.Image.0x0006 Short 1 2742
Exif.Image.0x0007 Short 1 3656

The first two contain the same numbers as those shown by dcraw, maybe I should use these as the pixel size values.

Any suggestions as to the meaning of these tags from the Panasonic camera owners? Can you confirm which pair corresponds to the actual image size?

-ahu.
Comment 10 caulier.gilles 2009-01-28 09:18:29 UTC
0x0002 and 0x0003 according to exiftool are the sensor width and height, while
0x0006 and 0x0007 are Image height and width. 0x0004 is sensor top border,
0x0005 is sensor left border.

Now, for my camera this is as follows:
Exif.Image.0x0002                            Short       1  4060
Exif.Image.0x0003                            Short       1  3016
Exif.Image.0x0004                            Short       1  4
Exif.Image.0x0005                            Short       1  8
Exif.Image.0x0006                            Short       1  3004
Exif.Image.0x0007                            Short       1  4008

I would have assumed that sensor height - 2* top border = image height, but as
you can see the numbers don't add up. The out-of-camera JPEGs are 4000x3000,
which corresponds to (image height - top border) x (image width - left
border). I think now that the tags 0x4 to 0x7 are only hints for the
processing software about how many usable pixels are there. The raw image is
probably the size of the sensor, so I'm tempted to say 0x2 and 0x3 are the
correct raw image size. its then up to the processor to chose a suitable
portion of the sensor area.

regards,
matthias
Comment 11 S. Burmeister 2009-01-31 15:27:05 UTC
what about the original issue of sensitivity now showing/being extracted?
Comment 12 caulier.gilles 2009-01-31 15:33:03 UTC
This is a question for Andreas (:=)))

Gilles
Comment 13 Andreas Huggel 2009-01-31 16:10:40 UTC
You mean the ISO value, right? Apparently it is the value of Exif.Image.0x0017, i.e., it is decoded but the tag doesn't have a name.

The RW2 decoding code in Exiv2 is not complete yet. Many of these Exif.Image.* tags don't have names (some even have wrong names currently) because I'm simply using the standard IFD0 tag table, instead of a new Panasonic RAW image specific tag table. Also, and a bit more difficult to get at, most of the Exif data is embedded in the JPEG preview image of the RW2 image. But no worries, we'll get there too.

-ahu.
Comment 14 S. Burmeister 2009-01-31 16:48:01 UTC
Seems o, yes. At least http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Panasonic.html
and http://search.cpan.org/~exiftool/Image-ExifTool-7.60/lib/Image/ExifTool/TagNames.pod#Panasonic_Raw_Tags list that address as the ISO speed aka sensitivity in digikam.
Comment 15 Andreas Huggel 2009-02-02 17:36:17 UTC
The latest revision in the Exiv2 repository improves RW2 decoding: http://dev.exiv2.org/repositories/revision/exiv2/1740
+ there is now a dedicated tag table for the IFD0 tags in these images
+ additional Exif data from the embedded preview image is decoded

The ISO speed is now labeled but there is still no lens information. Chances are that it's there somewhere just not yet reverse-engineered.

I appreciate if you test with more RW2 images but also all other formats.

-ahu.
Comment 16 Matthias Welwarsky 2009-02-02 17:51:26 UTC
(In reply to comment #15)
> The latest revision in the Exiv2 repository improves RW2 decoding:
> http://dev.exiv2.org/repositories/revision/exiv2/1740
> + there is now a dedicated tag table for the IFD0 tags in these images
> + additional Exif data from the embedded preview image is decoded
> 
> The ISO speed is now labeled but there is still no lens information. Chances
> are that it's there somewhere just not yet reverse-engineered.

I didn't find any lens information inside the RW2 tags (not in clear text anyway), but since you are fetching Exif data from the embedded preview image anyway, chances are you'll find it there. For the Lumix G1, the lens model and serial number are encoded in the maker notes, tag 0x0051 and 0x0052.

There are of course chances the lens information is also available in some binary encoded format. Also, there is still that rumor about lens defect correction data embedded in the RW2 files...
Comment 17 Andreas Huggel 2009-02-02 18:10:57 UTC
Yes, these lens tags are there:

ahuggel@mowgli> ./exiv2 -PEkycxt P1010158.RW2 | grep -e 0x005[12] -e Exif.PanasonicRaw.Model
0x0110 Exif.PanasonicRaw.Model                      Ascii       7  DMC-G1
0x0051 Exif.Panasonic.LensType                      Ascii      34  LUMIX G VARIO 14-45/F3.5-5.6
0x0052 Exif.Panasonic.LensSerialNumber              Ascii      14  08SG1171038

But images from some other models don't have these tags (eg, DMC-LX3, DMC-FZ28).

-ahu.
Comment 18 Matthias Welwarsky 2009-02-02 18:25:32 UTC
(In reply to comment #17)
> Yes, these lens tags are there:
> 
> ahuggel@mowgli> ./exiv2 -PEkycxt P1010158.RW2 | grep -e 0x005[12] -e
> Exif.PanasonicRaw.Model
> 0x0110 Exif.PanasonicRaw.Model                      Ascii       7  DMC-G1
> 0x0051 Exif.Panasonic.LensType                      Ascii      34  LUMIX G
> VARIO 14-45/F3.5-5.6
> 0x0052 Exif.Panasonic.LensSerialNumber              Ascii      14  08SG1171038
> 
> But images from some other models don't have these tags (eg, DMC-LX3,
> DMC-FZ28).
> 

The DMC-LX3 has a fixed lens, Leica DC Vario-Summicron, the DMC-FZ28 has also a fixed lens, Leica DC Vario-Elmarit. Maybe that's the reason why it's not encoded in the files...

Comment 19 S. Burmeister 2009-02-03 18:45:39 UTC
Sensitivity works now, the lens is simply not available for the LX3 I guess. Thanks a lot for fixing!
Comment 20 Matthias Welwarsky 2009-02-05 09:05:17 UTC
(In reply to comment #15)
> The latest revision in the Exiv2 repository improves RW2 decoding:
> http://dev.exiv2.org/repositories/revision/exiv2/1740
> + there is now a dedicated tag table for the IFD0 tags in these images
> + additional Exif data from the embedded preview image is decoded
> 
> The ISO speed is now labeled but there is still no lens information. Chances
> are that it's there somewhere just not yet reverse-engineered.
> 
> I appreciate if you test with more RW2 images but also all other formats.
> 

I've tested the new release, there's much more information now extracted from the RW2 files. However, a bit too many. Not all data from the embedded preview image applies to the raw data, for example:

White balance information - doesn't apply to raw data, the processing software needs to apply that
Sharpness, Contrast, Saturation, Film mode - also not applicable to RAW data, these are attributes of the cameras' JPEG rendering process
Digital Zoom - also not applicable to RAW data. It should display "0" anyway, I think no camera allows enabling digital zoom while shooting RAW.

Not a comprehensive list, I'll make one this weekend.

> -ahu.
> 

Comment 21 Matthias Welwarsky 2009-02-07 15:01:21 UTC
Created attachment 31080 [details]
sensible information for RW2 files
Comment 22 Matthias Welwarsky 2009-02-07 15:02:30 UTC
Comment on attachment 31080 [details]
sensible information for RW2 files

I've made a list of tags with sensible information for RW2 files. All tags are marked with KEEP or DROP. I've not commented on undecoded tags
Comment 23 Matthias Welwarsky 2009-02-08 10:51:17 UTC
Created attachment 31114 [details]
drop JPEG engine tags on rw2 files

This is the patch implementing dropping my suggested list of JPEG engine tags from the exif data.
Comment 24 caulier.gilles 2009-02-08 10:57:17 UTC
Andreas,

Look comment #23, it's a patch for Exiv2

Gilles
Comment 25 Andreas Huggel 2009-02-10 10:08:45 UTC
Thanks, Matthias! The patch looks good, I'll apply it tonight. It will pose a challenge once we can write to RW2 images though, as the current logic doesn't have any provision to ignore tags. But we can worry about this later.

-ahu.
Comment 26 caulier.gilles 2019-12-23 17:39:56 UTC
Not reproducible with digiKam 7.0.0-beta1.