Correct the handling of "equal buckets conversion". This is probably
authorhpa <hpa>
Wed, 9 May 2001 17:48:31 +0000 (17:48 +0000)
committerhpa <hpa>
Wed, 9 May 2001 17:48:31 +0000 (17:48 +0000)
correct, but risks floating-point errors, which is a major concern.

ppmtolss16

index 357a601..8c467fc 100755 (executable)
@@ -53,9 +53,9 @@ sub rgbconvert($$) {
     my($r,$g,$b);
 
     ($r, $g, $b) = unpack("CCC", $rgb);
-    $r = int($r*$maxmult+0.5);
-    $g = int($g*$maxmult+0.5);
-    $b = int($b*$maxmult+0.5);
+    $r = int($r*$maxmult);
+    $g = int($g*$maxmult);
+    $b = int($b*$maxmult);
     $rgb = pack("CCC", $r, $g, $b);
     return $rgb;
 }