[Digikam-devel] [Bug 125916] New: Problem with opening 16bit TIFF

classic Classic list List threaded Threaded
64 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From caulier.gilles free fr  2006-06-02 08:07 -------
Gabor,

Warning : kuickshow and konqueror decode your 16 bits tiff using 8 bits mode. It's not the same way ! The only way to check properlly 16 bits decoding into linux is to use ImageMagick like this :

# display foo.tiff

I will had more debug informations in digiKam tiff loader to trace all options/rules used to decode your image. Let's me some times to commit changes

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-06-02 19:06 -------
Gilles,

No problem. Take your time. As I see no one else has this problem, so I guess it is no so urgent.
(BTW: I have tried $display foo_16bit.tiff  no problem, correct picture)

Regards,
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-06-02 19:07 -------
some addition:

An interesting thing that might mean something:
I have opened a 8 bit image with digikam, converted to 16 bit from the menu, and saved it as TIFF. 'display' worked fine, however digiKam opened it with the same error as with the spider picture!

Regards,
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         
caulier.gilles free fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|general                     |Image Editor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Dik Takken
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From d.h.j.takken phys uu nl  2006-08-05 17:45 -------
I would like to report that I experience exactly the same problem with opening 16-bit TIFF images. Some details:

* DigiKam 0.9.0-beta1
* KDE 3.5.3
* LibTIFF 3.8.2
* Gentoo Linux
* AMD Athlon 800 MHz

The images look distorted exactly like shown in the attachment. The same image is displayed perfectly in other 16-bit capable applications, like CinePaint and Krita.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Marcel Wiesweg
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From marcel.wiesweg gmx de  2006-08-05 22:55 -------
Created an attachment (id=17241)
 --> (http://bugs.kde.org/attachment.cgi?id=17241&action=view)
Debug statements

All works perfectly here, I can't reproduce this.
The attached patch adds some debug statements, perhaps we can find any
differences. Just wild guessing, I don't know where this comes from.
Please try with the spider picture, I can test with this one as well.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-08-07 21:53 -------
I would like to really know what can cause this problem. Now I am happy to know that I am not the only one who has this problem with 16bit TIFF images.
Dik, please let me know if my spider image produce the same bad output.

Thanks,
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From caulier.gilles free fr  2006-08-17 02:54 -------
Marcel,

If something is mising in the DImg::TiffLoader implementation, We can compare the ImageMagick TIFF Loader witch run properlly under Dubas system using "display IMG_4224-01.tif"

You can find the url to the ImageMagick implementation into the header on the tiffloader.cpp

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-08-17 22:39 -------
In reply to Comment #24 to Marcel:

I have compiled the svn with the included debug patch. The image output is the same.
Here is the debug statements from digiKam:


digikam: /home/dudeeg/pics/CanonEOS/digikam_16bit_TIFF_test/IMG_4224-01.tif : TIFF file identified
digikam: Loading TIFF file 923 x 590 bits_per_sample 16 samples_per_pixel 0 rows_per_strip 1 strip_size 5538 num_of_strips 590
digikam: Read 5538 bytes from strip 0, offset 0
digikam: Read 5538 bytes from strip 1, offset 5538
digikam: Read 5538 bytes from strip 2, offset 11076
digikam: Read 5538 bytes from strip 3, offset 16614
digikam: Read 5538 bytes from strip 4, offset 22152
digikam: Read 5538 bytes from strip 5, offset 27690
digikam: Read 5538 bytes from strip 6, offset 33228
digikam: Read 5538 bytes from strip 7, offset 38766
digikam: Read 5538 bytes from strip 8, offset 44304
digikam: Embedded profile: sRGB IEC61966-2.1


Regards,
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Marcel Wiesweg
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         
marcel.wiesweg gmx de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      everconfirmed|0                           |1



------- Additional Comments From marcel.wiesweg gmx de  2006-08-18 23:33 -------
Thanks for testing.
The problem is "samples_per_pixel 0".
Here it is "samples_per_pixel 3", as one would assume for an RGB image. 0 samples per pixel is a bit problematic ;-)
(We do not check for 0, we assume 3 or 4. Subsequently, the image data will be read as if it has 4 samples per pixel, which explains the interesting output you are getting)

So next we need to have an idea why this value is wrong.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From caulier.gilles free fr  2006-08-19 11:35 -------
Right Marcel. This is certainly a bug in libtiff...

Look in Exif Metadata tab. We have :

- bits per sample   = 16 16 16.
- samples per pixel = 3.

Certainly, something is missing in Digikam::DImg::TiffLoader to use libtiff against library bugs. I recommend you to check the ImageMagick tiffloader implementation (ReadTIFFImage() method) witch work perfectly with the "Spider" picture.

https://subversion.imagemagick.org/subversion/ImageMagick/trunk/coders/tiff.c

Note: in digiKam, we don't test the TIFFTAG_PHOTOMETRIC interpretation of tiff image. In fact if the image is not RGB, a conversion must be done like libtiff can do to import directly all photometric image types to RGB.

Dik, since you have the same problem than Gabor, can you provide another sample image TIFF to test ? Thanks in advance.

Gilles Caulier
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Marcel Wiesweg
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From marcel.wiesweg gmx de  2006-09-02 17:34 -------
SVN commit 580080 by mwiesweg:

- check that rows_per_strip, bits_per_sample and samples_per_pixel is not 0.
  If these value are invalid, refuse to load.
  - rows_per_strip of 0 results in an endless loop
  - samples_per_pixel of 0 is invalid, leads to bad data
- use TiffGetFieldDefaulted instead of TiffGetField (inspired by ImageMagick)

Note: this does not fix the problem that libtiff returns invalid values,
but now digikam notices the fact.

CCBUG: 125916



 M  +20 -7     tiffloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp #580079:580080
 @ -124,19 +124,32  @
     tsize_t   strip_size;
     tstrip_t  num_of_strips;
 
-    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
-    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_IMAGEWIDTH, &w);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_IMAGELENGTH, &h);
 
-    TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bits_per_sample);
-    TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel);
-    TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bits_per_sample);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel);
+    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);
 
-    if (TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rows_per_strip) == 0)
+    if (TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rows_per_strip) == 0 || rows_per_strip == 0)
     {
-        kdDebug() << k_funcinfo << "Can't handle non-stripped images." << endl;
+        kdWarning()  << "TIFF loader: Cannot handle non-stripped images. Loading file " << filePath << endl;
         TIFFClose(tif);
         return false;
     }
+
+    if (bits_per_sample == 0 ||
+        samples_per_pixel == 0 ||
+        rows_per_strip == 0)
+    {
+        kdWarning() << "TIFF loader: Encountered invalid value 0 in image."
+                    << " bits_per_sample " << bits_per_sample
+                    << " samples_per_pixel " << samples_per_pixel
+                    << " rows_per_strip " << rows_per_strip
+                    << " Loading file " << filePath << endl;
+        TIFFClose(tif);
+        return false;
+    }
     
     TIFFGetFieldDefaulted(tif, TIFFTAG_PHOTOMETRIC, &photometric);
 /*
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From caulier.gilles free fr  2006-09-03 10:44 -------
SVN commit 580300 by cgilles:

digikam from trunk : DImg::TiffLoader : digiKam cannot handle TIFF file without RGB color-space.

Marcel, this is still to do in tiff decoder RGB color-space is used with 90% of tiff files, especially with photograph pictures, but we need to finalize this part to support others tiff color-spaces.

This commit prevent dummy image data decoding in editor.

CCBUGS: 125916

 M  +6 -3      tiffloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp #580299:580300
 @ -151,15 +151,18  @
         return false;
     }
     
+    // TODO: check others TIFF color-spaces here. Actually, only RGB is supported.
+    // Complete description of TIFFTAG_PHOTOMETRIC tag can be found at this url:
+    // http://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
+
     TIFFGetFieldDefaulted(tif, TIFFTAG_PHOTOMETRIC, &photometric);
-/*
     if (photometric != PHOTOMETRIC_RGB)
     {
-        kdWarning() << k_funcinfo << "Can't handle image without RGB photometric: " << photometric << endl;
+        kdWarning() << "Can't handle image without RGB color-space: "
+                    << photometric << endl;
         TIFFClose(tif);
         return false;
     }
-  */  
     
     if (samples_per_pixel == 4)
         m_hasAlpha = true;
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From caulier.gilles free fr  2006-09-03 10:52 -------
SVN commit 580303 by cgilles:

digikam from trunk : DImg::TiffLoader : the loader work fine with PHOTOMETRIC_MINISBLACK TIFF color-space (Blacl & white picture converted with ImageMagick).

Marcel, we need to check the current implementation with others TIFF color-spaces. There are a lots of tiff sample pictures in libtiff repository :

http://www.remotesensing.org/libtiff/images.html

CCBUGS: 125916

 M  +7 -2      tiffloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp #580302:580303
 @ -21,6 +21,9  @
  * - http://freeimage.cvs.sourceforge.net/freeimage/FreeImage/Source/Metadata/XTIFF.cpp
  * - https://subversion.imagemagick.org/subversion/ImageMagick/trunk/coders/tiff.c
  *
+ * Test images repository:
+ * - http://www.remotesensing.org/libtiff/images.html
+ *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
  * Public License as published by the Free Software Foundation;
 @ -151,12 +154,14  @
         return false;
     }
     
-    // TODO: check others TIFF color-spaces here. Actually, only RGB is supported.
+    // TODO: check others TIFF color-spaces here. Actually, only RGB and MINISBLACK
+    // have been tested.
     // Complete description of TIFFTAG_PHOTOMETRIC tag can be found at this url:
     // http://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
 
     TIFFGetFieldDefaulted(tif, TIFFTAG_PHOTOMETRIC, &photometric);
-    if (photometric != PHOTOMETRIC_RGB)
+    if (photometric != PHOTOMETRIC_RGB ||
+        photometric != PHOTOMETRIC_MINISBLACK)
     {
         kdWarning() << "Can't handle image without RGB color-space: "
                     << photometric << endl;
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-09-29 22:01 -------
I have just compiled digiKam 0.9 svn. As Marcel commented at #30 I get an error message from digiKam and it refuses to load to TIFF image.

The message is:
-----------
digikam: /home/dudeeg/pics/digikam_16bit_TIFF_test/IMG_4224-01.tif : TIFF file identified
digikam: Cannot load metadata using Exiv2 (/home/dudeeg/pics/digikam_16bit_TIFF_test/IMG_4224-01.tif: The file contains                      data of an unknown image type)
digikam: WARNING: TIFF loader: Encountered invalid value 0 in image. bits_per_sample 16 samples_per_pixel 0 rows_per_strip 1 Loading file /home/dudeeg/pics/digikam_16bit_TIFF_test/IMG_4224-01.tif
digikam: WARNING: [Digikam::DImg* Digikam::DImgInterface::getImg()] d->image is NULL
digikam: Cannot load metadata using Exiv2 (/home/dudeeg/pics/digikam_16bit_TIFF_test/IMG_4224-01.tif: The file contains                      data of an unknown image type)
digikam: WARNING: Failed to load image IMG_4224-01.tif
---------

Do you have a plan for the future to fix this problem?

Thanks!
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Marcel Wiesweg
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From marcel.wiesweg gmx de  2006-09-30 15:08 -------
I would like to fix this, but I am stuck with the question why libtiff returns the value 0, more precisely, why it returns this value only on your system and a few others.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-09-30 18:39 -------
I admit it is very strange. Actually I am using 2 PCs at home, but both of them produce the same "effect". The libtiff versions are different on the two machines, but both of them are running Slackware 10.1.
Just let me know if I can help you by trying out this and that on these boxes.

Thanks and regards,
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Gilles Caulier
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From caulier.gilles free fr  2006-10-01 10:17 -------
Marcel,

You can get some help from libtiff developper mailing list. This one is very active:

http://lists.maptools.org/mailman/listinfo/tiff

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Marcel Wiesweg
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From marcel.wiesweg gmx de  2006-10-03 15:37 -------
Gabor,

before we ask the libtiff mailing list, could you (if not yet done), to rule out problems,

- get latest libtiff release from ftp://ftp.remotesensing.org/pub/libtiff and compile and install it from source
- verify with ldd (ldd `which digikam` | grep tiff) that the same file that you installed from source is used
- the bug still exists
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF

Bugzilla from dudasg@freemail.hu
In reply to this post by Bugzilla from dudasg@freemail.hu
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125916         




------- Additional Comments From dudasg freemail hu  2006-10-03 15:53 -------
No problem, I will try to do it within the next few days.

Regards,
Gabor
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
1234