AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
March 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



2006.03.17 22:36 "patch for bmp2tiff", by Mikhail Kruk

Attached is a patch for bmp2tiff tool which fixes a bug in dealing
with BMPs with RLE encodings.

In absolute mode the sequence of non-encoded pixels must be
word-aligned.  Attached is a file which doesn't get properly converted
with unpatched bmp2tiff and works with the patch.  I only have file to
demonstrate it for RLE-4 case but I assumed that RLE-8 works the same
way so changed in both places.


--- /cygdrive/c/temp/tiff-3.8.1/tools/bmp2tiff.c.orig	2006-03-17   12:55:15.492279300 -0500
+++ /cygdrive/c/temp/tiff-3.8.1/tools/bmp2tiff.c 2006-03-17 12:55:33.008352700 -0500
@@ -635,7 +635,7 @@
 				  	runlength = comprbuf[i++];
 					for (k = 0; k < runlength && j <   uncompr_size && i < compr_size; k++)
 					    uncomprbuf[j++] = comprbuf[i++];
-					if ( k & 0x01 )
+					if ( i & 0x01 )
 					    i++;
 				    }
 				}
@@ -675,7 +675,7 @@
					    else
 						uncomprbuf[j++] = (comprbuf[i] &   0xF0) >> 4;
 					}
-					if (k & 0x01)
+					if (i & 0x01)
 					    i++;
 				    }
 				}