diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index e852fc00f0..d8d449c5cf 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -659,6 +659,13 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo // 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++ ) diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 010bc1d278..9135e433b9 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -1115,6 +1115,7 @@ static void TestTIFFImage(const wxString& option, int value) void ImageTestCase::SaveTIFF() { TestTIFFImage(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, 1); + TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 1); } void ImageTestCase::SaveAnimatedGIF()