amersons / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

liblept v1.71 does not load 48bpp TIFF images (when it can/should) #104

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download liblept v1.71
2. Using libtiff 4.0.3 and libjpeg 9a
3. Compile with VS2013
4. Try to call pixRead() or pixReadTIiff() using a 48bpp TIFF image
5. Call fails because bpp > 32

What is the expected output? What do you see instead?
With the code 'as is' the 48bpp TIFF fails to load. Changing the max bpp to 48 
allows the TIFF to load. Not sure if this will break other liblept 
functionality; haven't gotten that far in my testing yet.

What version of the product are you using? On what operating system?
liblept v1.71, libtiff 4.0.3, libjpeg 9a. Windows, VS2013.

Please provide any additional information below.
Test image = rgb-3c-16b.tiff from the libtiff test folder (attached).

Original issue reported on code.google.com by dcree...@gmail.com on 20 Aug 2014 at 3:48

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for this report, and the sample testing image.

The leptonica tiff library has never been able to read 16 bps RGB images, and I 
agree that it should, if only to downsample each component to 8 bits using the 
MSB.

Changing the max bpp from 32 to 48 will not solve the problem.

I will look at this in the next month and let you know if/when it works.

Original comment by dan.bloo...@gmail.com on 9 Sep 2014 at 2:42

GoogleCodeExporter commented 9 years ago
Actually, libtiff does handle the problem, doing the stripping by default.

Attached is a fixed version of tiffio.c.  It reads your 16bit rgb image.  This 
will go out in 1.72.

Original comment by dan.bloo...@gmail.com on 11 Sep 2014 at 6:16

Attachments:

GoogleCodeExporter commented 9 years ago
Hey Dan. As I mentioned in my original entry, just changing the BPP to 48 
allowed me to open the example TIFF. I just didn't know if it would blow up 
Leptonica or LibTiff somewhere else; I hadn't done any testing of other 
functionality. Thanks for confirming it should work. I'll test out the new 
tiffio.c when I get home tonight.

Original comment by dcree...@gmail.com on 11 Sep 2014 at 7:16

GoogleCodeExporter commented 9 years ago
I built Leptonica v1.72 beta's rotateorthtest1 on Windows 7 64bit using VS2008, 
and then ran:

  rotateorthtest1.exe rgb-3c-16b.tiff rgb-3c-16b-rotated.jpg

It said:

  Warning in pixReadFromTiffStream: bpp = 48; stripping 16 bit rgb samples down to 8

and resulted in a correct (but artifacty) looking 90degree rotated 151x157x24b 
jpeg image. 

Original comment by tomp2...@gmail.com on 12 Jan 2015 at 9:26