]> git.saurik.com Git - wxWidgets.git/commitdiff
Improved saving of TIFF monochrome images.
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Fri, 19 Aug 2011 01:08:36 +0000 (01:08 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Fri, 19 Aug 2011 01:08:36 +0000 (01:08 +0000)
When reducing an RGB image to black and white any non-black pixel was treated as white resulting in mostly white images. Set the threshold to 127 instead to improve the looks of saved monochrome TIFF images.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/imagtiff.cpp

index 59b7fb9b432ca4ffaed6ca5d5dff34d266ffa613..a10940d63ce865c0402d38f55cd447584b221a48 100644 (file)
@@ -658,7 +658,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
                     uint8 reverse = 0;
                     for ( int bp = 0; bp < 8; bp++ )
                     {
-                        if ( ptr[column*24 + bp*3] > 0 )
+                        if ( ptr[column*24 + bp*3] > 127 )
                         {
                             // check only red as this is sufficient
                             reverse = (uint8)(reverse | 128 >> bp);