Bug 152527

Summary: Digikam can't read Image Size and Bit Depth of PNGs generated by UFRAW (latest stable)
Product: [Applications] digikam Reporter: Ar <ari.reads>
Component: Metadata-RawAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.9.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 0.10.0
Sentry Crash Report:
Attachments: digiKam for KDE4 vs gimp

Description Ar 2007-11-19 01:15:13 UTC
Version:            (using KDE KDE 3.5.8)
OS:                Linux

Digikam/showfot can't read Image Size and Bit Depth of PNGs generated by UFRAW (latest stable = 0.13)



Krita, Gimp have no problems showing size and color depth of the same file. 

Apparently digikam image processing / editing does occur properly at 16bits, althought I'm not sure...

Example:
for this image: http://arielpablo.com.ar/unprotected-files/DSC_0006_digikam.png

Digikam 0.9.2 and 0.9.3SVN (today) display: 
Dimensions: unknown
Compression: unavailable
bit depth: unavailable
color mode: unavailable

After editing and saving, the problem persists when reopening the edited image with digikam/showfoto
Comment 1 Arnd Baecker 2007-11-19 07:41:33 UTC
Which version of exiv2 do you use (see the Help/About digikam/About)?
What does exiv2 DSC_0006_digikam.png show?
Comment 2 caulier.gilles 2007-11-19 08:23:03 UTC
Arnd,

Here, this is not the fault to Exiv2, but KDE API and especially KFileMetaInfo...

Look in the code, at digikam/libs/imageproperties/imagepropertiestab.cpp, line 468

KFileMetaInfo do not search Exif info in PNG for that. It scan whole file to find PNG Chunk witch include image informations (PNG ImageHeader Tags : http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#ImageHeader). 

It's completly different than the way used by Exiv2 witch do not know (yet) this chunk, but only try to find the text chunk used to embed Exif informations as a byte-array (same for IPTC and XMP). Of course i can patch Exiv2 for that...

But this is not the real problem here. Now try to parse this image with exiftool like this :

exiftool -g DSC_0006_digikam.png
======== DSC_0006_digikam.png
---- ExifTool ----
ExifTool Version Number         : 7.00
Warning                         : Bad NikonPreview directory
---- File ----
File Name                       : DSC_0006_digikam.png
Directory                       : .
File Size                       : 3 MB
File Modification Date/Time     : 2007:11:19 07:50:02
File Type                       : PNG
MIME Type                       : image/png
Exif Byte Order                 : Little-endian (Intel)
---- PNG ----
Bit Depth                       : 16
Color Type                      : RGB
Filter                          : Adaptive
Interlace                       : Noninterlaced
Significant Bits                : 16 16 16
Source                          : NIKOND80
Software                        : digiKam 0.9.2-final ( libpng version 1.2.15beta5 - December 8, 2006 (header) )
IPTC Profile                    : (Binary data 134611 bytes, use -b option to extract)
---- ICC_Profile ----
Profile CMM Type                : scrs
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2001:04:12 19:02:14
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : none
Device Model                    : none
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : scrs
Profile ID                      : 0
Profile Description             : Wide Gamut RGB
Profile Copyright               :
Media White Point               : 0.9642 1 0.82491
Media Black Point               : 0 0 0
Red Matrix Column               : 0.71651 0.25874 0
Green Matrix Column             : 0.10103 0.72469 0.05122
Blue Matrix Column              : 0.14679 0.0166 0.7739
Red Tone Reproduction Curve     : (Binary data 524 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 524 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 524 bytes, use -b option to extract)
---- EXIF ----
Processing Software             : digiKam-0.9.2-final
Subfile Type                    : Full-resolution Image
Image Width                     : 684
Image Height                    : 1024
Bits Per Sample                 : 12
Compression                     : Nikon NEF Compressed
Photometric Interpretation      : Color Filter Array
Document Name                   : DSC_0006.png
Make                            : NIKON CORPORATION
Camera Model Name               : NIKON D80
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 1
X Resolution                    : 300
Y Resolution                    : 300
Planar Configuration            : Chunky
Resolution Unit                 : inches
Modify Date                     : 2007:09:30 15:58:25
Reference Black White           : 0 255 0 255 0 255
CFA Repeat Pattern Dim          : 2 2
CFA Pattern 2                   : 1 2 0 1
Exposure Time                   : 1/200
F Number                        : 5.3
Exposure Program                : Program AE
ISO                             : 500
Create Date                     : 2007:09:30 15:58:25
Exposure Compensation           : 0
Max Aperture Value              : 5.1
Metering Mode                   : Center-weighted average
Flash                           : No Flash
Focal Length                    : 58.0mm
User Comment                    :
Sub Sec Time                    : 50
Sub Sec Time Original           : 50
Sub Sec Time Digitized          : 50
Exif Image Width                : 684
Exif Image Length               : 1024
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Custom Rendered                 : Normal
Exposure Mode                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 87mm
Scene Capture Type              : Standard
Gain Control                    : Low gain up
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Subject Distance Range          : Unknown (0)
Date/Time Original              : 2007:09:30 15:58:25
TIFF-EP Standard ID             : 1 0 0 0
Sensing Method                  : One-chip color area
Thumbnail Offset                : 13487
Thumbnail Length                : 3584
---- MakerNotes ----
Maker Note Version              : 2.10
Color Mode                      : Color
Quality                         : Raw
White Balance                   : Auto
Focus Mode                      : AF-A
Flash Setting                   : Slow
Flash Type                      :
White Balance Fine Tune         : 0
Color Balance 1                 : 1.62109375 1.62109375 1 1
Program Shift                   : 0
Exposure Difference             : 0
Flash Exposure Compensation     : 0
ISO Setting                     : 500
Flash Exposure Bracket Value    : 0.0
Exposure Bracket Value          : 0
Crop Hi Speed                   : Off (3904x2616 cropped to 3904x2616 at pixel 0,0)
Serial Number                   : 5001393
Color Space                     : sRGB
Tone Comp                       : Auto
Lens Type                       : G
Lens                            : 18-135mm f/3.5-5.6
Flash Mode                      : Did Not Fire
AF Area Mode                    : Single Area
AF Point                        : Left
AF Points In Focus              : Left
Shooting Mode                   : Single-Frame
Auto Bracket Release            : Manual Release
NEF Curve 1                     : (Binary data 8256 bytes, use -b option to extract)
Light Source                    : Natural
Hue Adjustment                  : 0
Noise Reduction                 : Off
NEF Curve 2                     : (Binary data 1412 bytes, use -b option to extract)
Raw Image Center                : 1952 1308
Sensor Pixel Size               : 6.05 x 6.05 um
Shutter Count                   : 853
Image Optimization              : Normal
Vari Program                    :
Multi Exposure Version          : 0100
Multi Exposure Mode             : Off
Multi Exposure Shots            : 0
Multi Exposure Auto Gain        : Off
High ISO Noise Reduction        : Normal
Shot Info Version               : 0208
Vibration Reduction             : Off, Rotated 270 CW
WB RGGB Levels                  : 415 256 256 415
Lens Data Version               : 0202
Exit Pupil Position             : 102.4mm
AF Aperture                     : 5.0
Focus Position                  : 0x04
Focus Distance                  : 3.98 m
Lens ID Number                  : 143
Lens F Stops                    : 5.33
Min Focal Length                : 18.3mm
Max Focal Length                : 134.5mm
Max Aperture At Min Focal       : 3.6
Max Aperture At Max Focal       : 5.7
MCU Version                     : 145
Effective Max Aperture          : 5.2
---- Composite ----
Aperture                        : 5.3
Blue Balance                    : 1.621094
CFA Pattern                     : [Green,Blue][Red,Green]
Image Size                      : 684x1024
Lens ID                         : AF-S DX Zoom-Nikkor 18-135mm f/3.5-5.6G IF-ED
Lens                            : 18-135mm f/3.5-5.6 G
Red Balance                     : 1.621094
Scale Factor To 35mm Equivalent : 1.5
Shutter Speed                   : 1/200
Thumbnail Image                 : (Binary data 3584 bytes, use -b option to extract)
Circle Of Confusion             : 0.020 mm
Depth of Field                  : 1.00 m (3.54 - 4.54)
Focal Length                    : 58.0mm (35mm equivalent: 87.0mm)
Hyperfocal Distance             : 31.69 m
Light Value                     : 10.1
Date/Time Original              : 2007:09:30 15:58:25.50

All tags with an hexa number on starting line come from Exif/Makernotes embeded in text chunk like digiKam or Imagemagick do (i'm sure, i have talking about this subject with UFRAW author in Exiv2 mailing list)

Now look where are Dimensions, Compression, bit depth, and color mode ? Only on Exif byte array, not on PNG ImageHeader Tags...

Conclusion : i suspect than :

- this file is corrupted or uncomplete (where are dimension and compression infos ?)
- and something is wrong on KFileMetaInfo (why at least Bit Depth and Color Type are not found ?)

Gilles
Comment 3 caulier.gilles 2007-11-19 08:26:12 UTC
Oups, wrong exiftool console output, sorry. this one is better :

exiftool -g -H DSC_0006_digikam.png
---- ExifTool ----
     - ExifTool Version Number         : 7.00
     - Warning                         : Bad NikonPreview directory
---- File ----
     - File Name                       : DSC_0006_digikam.png
     - Directory                       : .
     - File Size                       : 3 MB
     - File Modification Date/Time     : 2007:11:19 07:50:02
     - File Type                       : PNG
     - MIME Type                       : image/png
     - Exif Byte Order                 : Little-endian (Intel)
---- PNG ----
0x0008 Bit Depth                       : 16
0x0009 Color Type                      : RGB
0x000b Filter                          : Adaptive
0x000c Interlace                       : Noninterlaced
     - Significant Bits                : 16 16 16
     - Source                          : NIKOND80
     - Software                        : digiKam 0.9.2-final ( libpng version 1.2.15beta5 - December 8, 2006 (header) )
     - IPTC Profile                    : (Binary data 134611 bytes, use -b option to extract)
---- ICC_Profile ----
0x0004 Profile CMM Type                : scrs
0x0008 Profile Version                 : 2.1.0
0x000c Profile Class                   : Display Device Profile
0x0010 Color Space Data                : RGB
0x0014 Profile Connection Space        : XYZ
0x0018 Profile Date Time               : 2001:04:12 19:02:14
0x0024 Profile File Signature          : acsp
0x0028 Primary Platform                : Microsoft Corporation
0x002c CMM Flags                       : Not Embedded, Independent
0x0030 Device Manufacturer             : none
0x0034 Device Model                    : none
0x0038 Device Attributes               : Reflective, Glossy, Positive, Color
0x0040 Rendering Intent                : Perceptual
0x0044 Connection Space Illuminant     : 0.9642 1 0.82491
0x0050 Profile Creator                 : scrs
0x0054 Profile ID                      : 0
     - Profile Description             : Wide Gamut RGB
     - Profile Copyright               :
     - Media White Point               : 0.9642 1 0.82491
     - Media Black Point               : 0 0 0
     - Red Matrix Column               : 0.71651 0.25874 0
     - Green Matrix Column             : 0.10103 0.72469 0.05122
     - Blue Matrix Column              : 0.14679 0.0166 0.7739
     - Red Tone Reproduction Curve     : (Binary data 524 bytes, use -b option to extract)
     - Green Tone Reproduction Curve   : (Binary data 524 bytes, use -b option to extract)
     - Blue Tone Reproduction Curve    : (Binary data 524 bytes, use -b option to extract)
---- EXIF ----
0x000b Processing Software             : digiKam-0.9.2-final
0x00fe Subfile Type                    : Full-resolution Image
0x0100 Image Width                     : 684
0x0101 Image Height                    : 1024
0x0102 Bits Per Sample                 : 12
0x0103 Compression                     : Nikon NEF Compressed
0x0106 Photometric Interpretation      : Color Filter Array
0x010d Document Name                   : DSC_0006.png
0x010f Make                            : NIKON CORPORATION
0x0110 Camera Model Name               : NIKON D80
0x0112 Orientation                     : Horizontal (normal)
0x0115 Samples Per Pixel               : 1
0x011a X Resolution                    : 300
0x011b Y Resolution                    : 300
0x011c Planar Configuration            : Chunky
0x0128 Resolution Unit                 : inches
0x0132 Modify Date                     : 2007:09:30 15:58:25
0x0214 Reference Black White           : 0 255 0 255 0 255
0x828d CFA Repeat Pattern Dim          : 2 2
0x828e CFA Pattern 2                   : 1 2 0 1
0x829a Exposure Time                   : 1/200
0x829d F Number                        : 5.3
0x8822 Exposure Program                : Program AE
0x8827 ISO                             : 500
0x9004 Create Date                     : 2007:09:30 15:58:25
0x9204 Exposure Compensation           : 0
0x9205 Max Aperture Value              : 5.1
0x9207 Metering Mode                   : Center-weighted average
0x9209 Flash                           : No Flash
0x920a Focal Length                    : 58.0mm
0x9286 User Comment                    :
0x9290 Sub Sec Time                    : 50
0x9291 Sub Sec Time Original           : 50
0x9292 Sub Sec Time Digitized          : 50
0xa002 Exif Image Width                : 684
0xa003 Exif Image Length               : 1024
0xa300 File Source                     : Digital Camera
0xa301 Scene Type                      : Directly photographed
0xa401 Custom Rendered                 : Normal
0xa402 Exposure Mode                   : Auto
0xa404 Digital Zoom Ratio              : 1
0xa405 Focal Length In 35mm Format     : 87mm
0xa406 Scene Capture Type              : Standard
0xa407 Gain Control                    : Low gain up
0xa408 Contrast                        : Normal
0xa409 Saturation                      : Normal
0xa40a Sharpness                       : Normal
0xa40c Subject Distance Range          : Unknown (0)
0x9003 Date/Time Original              : 2007:09:30 15:58:25
0x9216 TIFF-EP Standard ID             : 1 0 0 0
0x9217 Sensing Method                  : One-chip color area
0x0201 Thumbnail Offset                : 13487
0x0202 Thumbnail Length                : 3584
---- MakerNotes ----
0x0001 Maker Note Version              : 2.10
0x0003 Color Mode                      : Color
0x0004 Quality                         : Raw
0x0005 White Balance                   : Auto
0x0007 Focus Mode                      : AF-A
0x0008 Flash Setting                   : Slow
0x0009 Flash Type                      :
0x000b White Balance Fine Tune         : 0
0x000c Color Balance 1                 : 1.62109375 1.62109375 1 1
0x000d Program Shift                   : 0
0x000e Exposure Difference             : 0
0x0012 Flash Exposure Compensation     : 0
0x0013 ISO Setting                     : 500
0x0018 Flash Exposure Bracket Value    : 0.0
0x0019 Exposure Bracket Value          : 0
0x001b Crop Hi Speed                   : Off (3904x2616 cropped to 3904x2616 at pixel 0,0)
0x001d Serial Number                   : 5001393
0x001e Color Space                     : sRGB
0x0081 Tone Comp                       : Auto
0x0083 Lens Type                       : G
0x0084 Lens                            : 18-135mm f/3.5-5.6
0x0087 Flash Mode                      : Did Not Fire
0x0000 AF Area Mode                    : Single Area
0x0001 AF Point                        : Left
0x0002 AF Points In Focus              : Left
0x0089 Shooting Mode                   : Single-Frame
0x008a Auto Bracket Release            : Manual Release
0x008c NEF Curve 1                     : (Binary data 8256 bytes, use -b option to extract)
0x0090 Light Source                    : Natural
0x0092 Hue Adjustment                  : 0
0x0095 Noise Reduction                 : Off
0x0096 NEF Curve 2                     : (Binary data 1412 bytes, use -b option to extract)
0x0099 Raw Image Center                : 1952 1308
0x009a Sensor Pixel Size               : 6.05 x 6.05 um
0x00a7 Shutter Count                   : 853
0x00a9 Image Optimization              : Normal
0x00ab Vari Program                    :
0x0000 Multi Exposure Version          : 0100
0x0001 Multi Exposure Mode             : Off
0x0002 Multi Exposure Shots            : 0
0x0003 Multi Exposure Auto Gain        : Off
0x00b1 High ISO Noise Reduction        : Normal
0x0000 Shot Info Version               : 0208
0x024e Vibration Reduction             : Off, Rotated 270 CW
0x0000 WB RGGB Levels                  : 415 256 256 415
0x0000 Lens Data Version               : 0202
0x0004 Exit Pupil Position             : 102.4mm
0x0005 AF Aperture                     : 5.0
0x0008 Focus Position                  : 0x04
0x0009 Focus Distance                  : 3.98 m
0x000b Lens ID Number                  : 143
0x000c Lens F Stops                    : 5.33
0x000d Min Focal Length                : 18.3mm
0x000e Max Focal Length                : 134.5mm
0x000f Max Aperture At Min Focal       : 3.6
0x0010 Max Aperture At Max Focal       : 5.7
0x0011 MCU Version                     : 145
0x0012 Effective Max Aperture          : 5.2
---- Composite ----
     - Aperture                        : 5.3
     - Blue Balance                    : 1.621094
     - CFA Pattern                     : [Green,Blue][Red,Green]
     - Image Size                      : 684x1024
     - Lens ID                         : AF-S DX Zoom-Nikkor 18-135mm f/3.5-5.6G IF-ED
     - Lens                            : 18-135mm f/3.5-5.6 G
     - Red Balance                     : 1.621094
     - Scale Factor To 35mm Equivalent : 1.5
     - Shutter Speed                   : 1/200
     - Thumbnail Image                 : (Binary data 3584 bytes, use -b option to extract)
     - Circle Of Confusion             : 0.020 mm
     - Depth of Field                  : 1.00 m (3.54 - 4.54)
     - Focal Length                    : 58.0mm (35mm equivalent: 87.0mm)
     - Hyperfocal Distance             : 31.69 m
     - Light Value                     : 10.1
     - Date/Time Original              : 2007:09:30 15:58:25.50

Gilles
Comment 4 caulier.gilles 2009-02-21 14:38:34 UTC
Created attachment 31519 [details]
digiKam for KDE4 vs gimp

Ar,

Look like the problem diseapear with digiKam for KDE4, where KFileMetaInfo is not used anymore...

I close this file now.

Gilles Caulier