When saving with a samples per pixel value of 1 the TIFF handler still treated the image as RGB, resulting in corrupted images. Handle the greyscale case and added a unit test for it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68784
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// color image
memcpy(buf, ptr, image->GetWidth());
}
+ else if (spp * bps == 8) // greyscale image
+ {
+ for ( int column = 0; column < linebytes; column++ )
+ {
+ buf[column] = ptr[column*3 + 1];
+ }
+ }
else // black and white image
{
for ( int column = 0; column < linebytes; column++ )
void ImageTestCase::SaveTIFF()
{
TestTIFFImage(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, 1);
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 1);
}
void ImageTestCase::SaveAnimatedGIF()