Possible patch/update to allow for a black/white image that has SAMPLEFORMAT tag set

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possible patch/update to allow for a black/white image that has SAMPLEFORMAT tag set

Michael Shiels [ MaS Software Inc ]

We have run into a number of these and found changing this code in tif_dirread.c but in the older 3.5.6/3.5.7 era code.  I don’t seem to have saved a copy of one of those images for comparison/testing purposes.  But basically the setfield would fail on _SAMPLEFORMAT for a 1bpp image.   So we attempt to copy the tag data but do not consider it an error – possibly not best solution, but we needed something quick in our case.

 

                              case TIFFTAG_DATATYPE:

                              case TIFFTAG_SAMPLEFORMAT:

                                             if (!TIFFFetchPerSampleShorts(tif, dp, &iv) ||

                                                 !TIFFSetField(tif, dp->tdir_tag, iv))

                                                            goto bad;

                                             break;

 

 

To this

 

                              case TIFFTAG_DATATYPE:

                                             if (!TIFFFetchPerSampleShorts(tif, dp, &iv) ||

                                                 !TIFFSetField(tif, dp->tdir_tag, iv))

                                                            goto bad;

                                             break;

                              case TIFFTAG_SAMPLEFORMAT:

                                             if (TIFFFetchPerSampleShorts(tif, dp, &iv))

                                                 TIFFSetField(tif, dp->tdir_tag, iv);

                                             break;

 

 

Would resolve the issue


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/