Bug report and patch: photometric interpretation of TIFF files
Paul Williams
tumble-devel@lists.brouhaha.com
Sat Dec 20 13:11:13 2003
This is a multi-part message in MIME format.
--------------010501080009090100000303
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
tumble 0.33 currently treats TIFFs as having photometric interpretation
min-is-white, resulting in negative images in the PDF if the photometric
interpretation was min-is-black.
It appears that a simple hack to tumble_tiff.c to read and use the
photometric interpretation does the trick, so that's what I've applied
and tested locally. I've attached a patch file. I've never submitted one
of these before, so I'd better say that I renamed tumble_tiff.c to
tumble_tiff.c.orig, made my change and tested it, and then "diff -u
tumble_tiff.c.orig tumble_tiff.c".
Regards,
Paul
--------------010501080009090100000303
Content-Type: text/plain;
name="tumble_tiff.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="tumble_tiff.c.patch"
--- tumble_tiff.c.orig 2003-12-09 16:45:43.000000000 +0000
+++ tumble_tiff.c 2003-12-20 20:50:01.000000000 +0000
@@ -274,6 +274,8 @@
Bitmap *bitmap = NULL;
int row;
+ uint16_t photometric_interp;
+ bool blackis1;
rect.min.x = 0;
rect.min.y = 0;
@@ -289,6 +291,11 @@
rect.max.y = image_info->height_samples;
}
+ if (1 != TIFFGetField (tiff_in, TIFFTAG_PHOTOMETRIC, & photometric_interp))
+ blackis1 = 0;
+ else
+ blackis1 = PHOTOMETRIC_MINISBLACK == photometric_interp;
+
bitmap = create_bitmap (& rect);
if (! bitmap)
@@ -333,7 +340,7 @@
bitmap,
0, /* ImageMask */
0, 0, 0, /* r, g, b */
- 0); /* BlackIs1 */
+ blackis1); /* BlackIs1 */
#endif
result = 1;
--------------010501080009090100000303--