2010.12.14 17:55 "[Tiff] patch to tif_jpeg.c", by Dwight Kelly

2011.01.01 13:53 "Re: [Tiff] Regression in libtiff 4.0 CVS when creating a JPEG RGB contig", by Even Rouault

Hum, and there's also another case that doesn't work.

If I have a 2 band image as source:

$ ./tools/tiffcp 2band.tif out.tif -c jpeg -p contig JPEGLib: Bogus input colorspace. out.tif: Error, can't write strip 0.

So, I'd also suggest changing:

if (td->td_photometric == PHOTOMETRIC_MINISWHITE || td-
>td_photometric == PHOTOMETRIC_MINISBLACK)

 sp->cinfo.c.in_color_space = JCS_GRAYSCALE;

into:

if == PHOTOMETRIC_MINISWHITE || td- ((td->td_photometric
>td_photometric

== PHOTOMETRIC_MINISBLACK) && td->td_samplesperpixel == 1)

 sp->cinfo.c.in_color_space = JCS_GRAYSCALE;