2014.05.01 20:49 "[Tiff] Inconsistencies in tiff library tool operation", by Prophet of the Way

2014.05.01 20:49 "[Tiff] Inconsistencies in tiff library tool operation", by Prophet of the Way

I am a long-time contributer to Netpbm. I am currently working on Netpbm programs tifftopnm and pamtotiff. With tifftopnm, certain images procured from the following site keep giving me problems:

ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz

To determine whether the problems were caused by Netpbm code or the Tiff library which it links to, I tried some tests. I ran tiff2rgba, tiff2ps, tiffcp and tiffcmp feeding images from the above test suite and recorded the exit codes. I also ran everything under valgrind.

I notice that the exit codes are not consistent. (See below.) For example, an input file which tiff2rgba successfully converts fails when compared against itself with tiffcmp.

These might be caused by errors in the Tiff library. Another possibility is that the images are half-accurate, not truly compliant to standards, and different programs handle them in different ways. Ideally, tools should be consistent; any differences should be documented.

Also, I'd like to know if there is a way to determine out whether a Tiff image file is faithful to specifications.

Tiff library version 4.0.3
GCC v. 4.5.1
Valgrind v. 3.6.0

---

Commands:

(1) tiff2rgba INPUT /tmp/output
(2) tiff2ps INPUT > /dev/null
(3) tiffcp -c none INPUT /tmp/output
(4) tiffcmp INPUT INPUT

Input Tiff image (INPUT), results (exit codes) produced by the above
4 commands, with * after exit code denoting valgrind error:

libtiffpic/jim___gg.tif                              0    0    0    0
libtiffpic/jim___dg.tif                              0    0    0    0
libtiffpic/jim___cg.tif                              0    0    0    0
libtiffpic/jim___ah.tif                              0    0    0    0
libtiffpic/quad-lzw.tif                              0    0    0    0
libtiffpic/g3test.tif                                0    0    0    0
libtiffpic/smallliz.tif                              0    0    1    1
libtiffpic/cramps.tif                                0    0    0    0
libtiffpic/quad-tile.tif                             0    0    0    1
libtiffpic/cramps-tile.tif                           0    0    0    1
libtiffpic/zackthecat.tif                            0    0    1    1
libtiffpic/text.tif                                  0    0    1   1*
libtiffpic/strike.tif                                0    0    0    0
libtiffpic/fax2d.tif                                 0    0    0    0
libtiffpic/pc260001.tif                              0    0    0    0
libtiffpic/quad-jpeg.tif                             0    0    0    1
libtiffpic/oxford.tif                                0    0    0    0
libtiffpic/ycbcr-cat.tif                             0  255    1    0
libtiffpic/dscf0013.tif                              0  255    1    0
libtiffpic/depth/flower-rgb-contig-32.tif            1  255    0    0
libtiffpic/depth/flower-rgb-contig-24.tif            1  255    0    0
libtiffpic/depth/flower-rgb-contig-16.tif            0    0    0    0
libtiffpic/depth/flower-rgb-contig-14.tif            1  255    0    0
libtiffpic/depth/flower-rgb-contig-12.tif            1  255    0    0
libtiffpic/depth/flower-rgb-contig-10.tif            1  255    0    0
libtiffpic/depth/flower-rgb-contig-08.tif            0    0    0    0
libtiffpic/depth/flower-rgb-contig-04.tif            1   0*    0    0
libtiffpic/depth/flower-rgb-contig-02.tif            1   0*    0    0
libtiffpic/depth/flower-separated-contig-16.tif      1    0    0    0
libtiffpic/depth/flower-separated-contig-08.tif      0    0    0    0
libtiffpic/depth/flower-palette-16.tif               1    0    0    0
libtiffpic/depth/flower-palette-08.tif               0    0    0    0
libtiffpic/depth/flower-palette-04.tif               0    0    0    0
libtiffpic/depth/flower-palette-02.tif               0    0    0    0
libtiffpic/depth/flower-rgb-planar-32.tif            1  255    0    0
libtiffpic/depth/flower-rgb-planar-24.tif            1  255    0    0
libtiffpic/depth/flower-rgb-planar-16.tif            0    0    0    0
libtiffpic/depth/flower-rgb-planar-14.tif            1  255    0    0
libtiffpic/depth/flower-rgb-planar-12.tif            1  255    0    0
libtiffpic/depth/flower-rgb-planar-10.tif            1  255    0    0
libtiffpic/depth/flower-rgb-planar-08.tif            0    0    0    0
libtiffpic/depth/flower-rgb-planar-04.tif            1    0    0    0
libtiffpic/depth/flower-rgb-planar-02.tif            1    0    0    0
libtiffpic/depth/flower-minisblack-32.tif            1  255    0    0
libtiffpic/depth/flower-minisblack-24.tif            1  255    0    0
libtiffpic/depth/flower-minisblack-16.tif            0    0    0    0
libtiffpic/depth/flower-minisblack-14.tif            1  255    0    0
libtiffpic/depth/flower-minisblack-12.tif            1  255    0    0
libtiffpic/depth/flower-minisblack-10.tif            1  255    0    0
libtiffpic/depth/flower-minisblack-08.tif            0    0    0    0
libtiffpic/depth/flower-minisblack-06.tif            1  255    0    0
libtiffpic/depth/flower-minisblack-04.tif            0    0    0    0
libtiffpic/depth/flower-minisblack-02.tif            0    0    0    0
libtiffpic/depth/flower-separated-planar-16.tif      1    0    0    0
libtiffpic/depth/flower-separated-planar-08.tif      0    0    0    0
libtiffpic/off_luv32.tif                             0    0    0    0
libtiffpic/off_luv24.tif                             0    0    0    0
libtiffpic/caspian.tif                               1  255    0    0
libtiffpic/off_l16.tif                               0    0    0    0
libtiffpic/jello.tif                                 0    0    0    0
libtiffpic/ladoga.tif                                0    0    0    0

---

Valgrind:
http://valgrind.org/

(Checks for accesses outside memory allocated by malloc, output of unspecified bits, branch decisions based upon unspecified bits, etc.)

Netpbm:
http://netpbm.sourceforge.net/
http://netpbm.sourceforge.net/doc/pamtotiff.html
http://netpbm.sourceforge.net/doc/tifftopnm.html

I've also tried test images from this archive: https://github.com/ZaaLabs/ZaaIL-TestImages/tree/master/

The results were similar. Let me know if you need a summary.

Real name: Akira Urushibata