diff --git a/coders/rgf.c b/coders/rgf.c
index e3d7a9f..cdbd3d8 100644
--- a/coders/rgf.c
+++ b/coders/rgf.c
@@ -366,7 +366,7 @@
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       byte>>=1;
-      if (GetPixelLuma(image,p) < (QuantumRange/2))
+      if (GetPixelLuma(image,p) < (QuantumRange/2.0))
         byte|=0x80;
       bit++;
       if (bit == 8)