diff --git a/coders/cals.c b/coders/cals.c
index 72bde2a..ead4165 100644
--- a/coders/cals.c
+++ b/coders/cals.c
@@ -542,7 +542,7 @@
         geometry_info;
 
       (void) ParseGeometry(image_info->density,&geometry_info);
-      density=(unsigned long) (geometry_info.rho+0.5);
+      density=(unsigned long) floor(geometry_info.rho+0.5);
     }
   (void) FormatMagickString(header,MaxTextExtent,"rdensty: %04lu",density);
   count=WriteCALSRecord(image,header);
diff --git a/coders/caption.c b/coders/caption.c
index 035572b..b7242cb 100644
--- a/coders/caption.c
+++ b/coders/caption.c
@@ -162,8 +162,9 @@
         if (draw_info->gravity == UndefinedGravity)
           (void) CloneString(&draw_info->geometry,geometry);
         status=GetMultilineTypeMetrics(image,draw_info,&metrics);
-        width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
-        height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+        width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+        height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+          0.5);
         if ((width > (image->columns+1)) || (height > (image->rows+1)))
           break;
         draw_info->pointsize*=2.0;
@@ -180,8 +181,9 @@
         if (draw_info->gravity == UndefinedGravity)
           (void) CloneString(&draw_info->geometry,geometry);
         status=GetMultilineTypeMetrics(image,draw_info,&metrics);
-        width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
-        height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+        width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+        height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+          0.5);
         if ((width > (image->columns+1)) || (height > (image->rows+1)))
           break;
         draw_info->pointsize++;
diff --git a/coders/dcm.c b/coders/dcm.c
index 450cdbe..b393c5d 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -3738,8 +3738,10 @@
                       window_max,
                       window_min;
 
-                    window_min=(long) (window_center-(window_width-1)/2.0-0.5);
-                    window_max=(long) (window_center+(window_width-1)/2.0-0.5);
+                    window_min=(long) ceil(window_center-(window_width-1)/2.0-
+                      0.5);
+                    window_max=(long) floor(window_center+(window_width-1)/2.0+
+                      0.5);
                     if ((long) pixel_value <= window_min)
                       index=0;
                     else
diff --git a/coders/emf.c b/coders/emf.c
index 86072fa..2489258 100644
--- a/coders/emf.c
+++ b/coders/emf.c
@@ -526,10 +526,11 @@
           flags=ParseMetaGeometry(geometry,&sans,&sans,&image->columns,
             &image->rows);
           if (image->x_resolution != 0.0)
-            image->columns=(unsigned long) ((image->columns*
+            image->columns=(unsigned long) floor((image->columns*
               image->x_resolution)+0.5);
           if (image->y_resolution != 0.0)
-            image->rows=(unsigned long) ((image->rows*image->y_resolution)+0.5);
+            image->rows=(unsigned long) floor((image->rows*image->y_resolution)+
+              0.5);
         }
       else
         {
@@ -537,11 +538,11 @@
           flags=ParseMetaGeometry(geometry,&sans,&sans,&image->columns,
             &image->rows);
           if (image->x_resolution != 0.0)
-            image->columns=(unsigned long) (((image->columns*
+            image->columns=(unsigned long) floor(((image->columns*
               image->x_resolution)/DefaultResolution)+0.5);
           if (image->y_resolution != 0.0)
-            image->rows=(unsigned long) (((image->rows*image->y_resolution)/
-              DefaultResolution)+0.5);
+            image->rows=(unsigned long) floor(((image->rows*
+              image->y_resolution)/DefaultResolution)+0.5);
         }
       geometry=DestroyString(geometry);
     }
diff --git a/coders/fpx.c b/coders/fpx.c
index ace1a4f..f43e558 100644
--- a/coders/fpx.c
+++ b/coders/fpx.c
@@ -282,7 +282,7 @@
       fpx_status=FPX_GetImageResultAspectRatio(flashpix,&aspect_ratio);
       if (fpx_status != FPX_OK)
         ThrowReaderException(DelegateError,"UnableToReadAspectRatio");
-      if (width != (unsigned long) ((aspect_ratio*height)+0.5))
+      if (width != (unsigned long) floor((aspect_ratio*height)+0.5))
         Swap(width,height);
     }
   fpx_status=FPX_GetSummaryInformation(flashpix,&summary_info);
diff --git a/coders/histogram.c b/coders/histogram.c
index ff5f3fc..8d4b841 100644
--- a/coders/histogram.c
+++ b/coders/histogram.c
@@ -305,7 +305,7 @@
       break;
     if ((channel & RedChannel) != 0)
       {
-        y=(long) (histogram_image->rows-scale*histogram[x].red+0.5);
+        y=(long) ceil(histogram_image->rows-scale*histogram[x].red-0.5);
         r=q+y;
         for ( ; y < (long) histogram_image->rows; y++)
         {
@@ -315,7 +315,7 @@
       }
     if ((channel & GreenChannel) != 0)
       {
-        y=(long) (histogram_image->rows-scale*histogram[x].green+0.5);
+        y=(long) ceil(histogram_image->rows-scale*histogram[x].green-0.5);
         r=q+y;
         for ( ; y < (long) histogram_image->rows; y++)
         {
@@ -325,7 +325,7 @@
       }
     if ((channel & BlueChannel) != 0)
       {
-        y=(long) (histogram_image->rows-scale*histogram[x].blue+0.5);
+        y=(long) ceil(histogram_image->rows-scale*histogram[x].blue-0.5);
         r=q+y;
         for ( ; y < (long) histogram_image->rows; y++)
         {
diff --git a/coders/jpeg.c b/coders/jpeg.c
index f311b70..460c33c 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -1778,8 +1778,8 @@
   jpeg_info.density_unit=(UINT8) 1;
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-      "Image resolution: %ld,%ld",(long) (image->x_resolution+0.5),
-      (long) (image->y_resolution+0.5));
+      "Image resolution: %ld,%ld",(long) ceil(image->x_resolution-0.5),
+      (long) ceil(image->y_resolution-0.5));
   if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
     {
       /*
diff --git a/coders/label.c b/coders/label.c
index 43a2d6d..84351c4 100644
--- a/coders/label.c
+++ b/coders/label.c
@@ -138,8 +138,9 @@
       status=GetMultilineTypeMetrics(image,draw_info,&metrics);
       for ( ; status != MagickFalse; draw_info->pointsize*=2.0)
       {
-        width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
-        height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+        width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+        height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+          0.5);
         if (((image->columns != 0) && (width > (image->columns+1))) ||
             ((image->rows != 0) && (height > (image->rows+1))))
           break;
@@ -147,8 +148,9 @@
       }
       for ( ; status != MagickFalse; draw_info->pointsize--)
       {
-        width=(unsigned long) (metrics.width+draw_info->stroke_width+0.5);
-        height=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
+        width=(unsigned long) floor(metrics.width+draw_info->stroke_width+0.5);
+        height=(unsigned long) floor(metrics.height+draw_info->stroke_width+
+          0.5);
         if ((image->columns != 0) && (width <= (image->columns+1)) &&
            ((image->rows == 0) || (height <= (image->rows+1))))
           break;
@@ -180,10 +182,11 @@
       draw_info->geometry=AcquireString(geometry);
     }
   if (image->rows == 0)
-    image->rows=(unsigned long) (metrics.height+draw_info->stroke_width+0.5);
-  if (image->rows == 0)
-    image->rows=(unsigned long) (draw_info->pointsize+draw_info->stroke_width+
+    image->rows=(unsigned long) floor(metrics.height+draw_info->stroke_width+
       0.5);
+  if (image->rows == 0)
+    image->rows=(unsigned long) floor(draw_info->pointsize+
+      draw_info->stroke_width+0.5);
   if (SetImageBackgroundColor(image) == MagickFalse)
     {
       InheritException(exception,&image->exception);
diff --git a/coders/msl.c b/coders/msl.c
index aa85eac..aa01509 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -6248,8 +6248,8 @@
               }
             }
           shadow_image=ShadowImage(msl_info->image[n],geometry_info.rho,
-            geometry_info.sigma,(long) (geometry_info.xi+0.5),(long)
-            (geometry_info.psi+0.5),&msl_info->image[n]->exception);
+            geometry_info.sigma,(long) floor(geometry_info.xi+0.5),(long)
+            floor(geometry_info.psi+0.5),&msl_info->image[n]->exception);
           if (shadow_image == (Image *) NULL)
             break;
           msl_info->image[n]=DestroyImage(msl_info->image[n]);
diff --git a/coders/mvg.c b/coders/mvg.c
index a1b4e68..5c71658 100644
--- a/coders/mvg.c
+++ b/coders/mvg.c
@@ -175,8 +175,8 @@
           continue;
         (void) sscanf(p,"viewbox %lf %lf %lf %lf",&bounds.x1,&bounds.y1,
           &bounds.x2,&bounds.y2);
-        image->columns=(unsigned long) ((bounds.x2-bounds.x1)+0.5);
-        image->rows=(unsigned long) ((bounds.y2-bounds.y1)+0.5);
+        image->columns=(unsigned long) floor((bounds.x2-bounds.x1)+0.5);
+        image->rows=(unsigned long) floor((bounds.y2-bounds.y1)+0.5);
         break;
       }
     }
diff --git a/coders/pcl.c b/coders/pcl.c
index 31852b5..ec1ac38 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -290,8 +290,8 @@
     /*
       Set PCL render geometry.
     */
-    width=(unsigned long) (bounds.x2-bounds.x1+0.5);
-    height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+    width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+    height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
     if (width > page.width)
       page.width=width;
     if (height > page.height)
@@ -323,8 +323,9 @@
     (void) ParseAbsoluteGeometry(image_info->page,&page);
   (void) FormatMagickString(density,MaxTextExtent,"%gx%g",
     image->x_resolution,image->y_resolution);
-  page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
-  page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+  page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+0.5);
+  page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+    0.5);
   (void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",
     page.width,page.height);
   image=DestroyImage(image);
diff --git a/coders/pdf.c b/coders/pdf.c
index e3bbbef..e7ad0d0 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -531,8 +531,8 @@
           "%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1,
            bounds.x1,bounds.y1);
         (void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry);
-        page.width=(unsigned long) (bounds.x2-bounds.x1+0.5);
-        page.height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+        page.width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+        page.height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
         hires_bounds=bounds;
       }
   }
@@ -587,8 +587,10 @@
   if (image_info->page != (char *) NULL)
     {
       (void) ParseAbsoluteGeometry(image_info->page,&page);
-      page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
-      page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+      page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+
+        0.5);
+      page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+        0.5);
       (void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",page.width,
         page.height);
     }
@@ -1263,9 +1265,9 @@
     (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
       &geometry.width,&geometry.height);
     scale.x=(double) (geometry.width*delta.x)/resolution.x;
-    geometry.width=(unsigned long) (scale.x+0.5);
+    geometry.width=(unsigned long) floor(scale.x+0.5);
     scale.y=(double) (geometry.height*delta.y)/resolution.y;
-    geometry.height=(unsigned long) (scale.y+0.5);
+    geometry.height=(unsigned long) floor(scale.y+0.5);
     (void) ParseAbsoluteGeometry(page_geometry,&media_info);
     (void) ParseGravityGeometry(image,page_geometry,&page_info,
       &image->exception);
diff --git a/coders/ps.c b/coders/ps.c
index 5ee5cbe..d204f5b 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -669,8 +669,8 @@
           "%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1,
           bounds.x1,bounds.y1);
         (void) SetImageProperty(image,"ps:HiResBoundingBox",geometry);
-        page.width=(unsigned long) (bounds.x2-bounds.x1+0.5);
-        page.height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+        page.width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+        page.height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
         hires_bounds=bounds;
       }
   }
@@ -722,8 +722,9 @@
     (void) ParseAbsoluteGeometry(image_info->page,&page);
   (void) FormatMagickString(density,MaxTextExtent,"%gx%g",
     image->x_resolution,image->y_resolution);
-  page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
-  page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+  page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+0.5);
+  page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+    0.5);
   (void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",
     page.width,page.height);
   read_info=CloneImageInfo(image_info);
@@ -1433,9 +1434,9 @@
     (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
       &geometry.width,&geometry.height);
     scale.x=(double) (geometry.width*delta.x)/resolution.x;
-    geometry.width=(unsigned long) (scale.x+0.5);
+    geometry.width=(unsigned long) floor(scale.x+0.5);
     scale.y=(double) (geometry.height*delta.y)/resolution.y;
-    geometry.height=(unsigned long) (scale.y+0.5);
+    geometry.height=(unsigned long) floor(scale.y+0.5);
     (void) ParseAbsoluteGeometry(page_geometry,&media_info);
     (void) ParseGravityGeometry(image,page_geometry,&page_info,
       &image->exception);
@@ -1482,9 +1483,9 @@
         else
           {
             (void) FormatMagickString(buffer,MaxTextExtent,
-              "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
-              (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),
-              (long) (bounds.y2+0.5));
+              "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+              (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),
+              (long) floor(bounds.y2+0.5));
             (void) WriteBlobString(image,buffer);
             (void) FormatMagickString(buffer,MaxTextExtent,
               "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
@@ -2088,8 +2089,9 @@
   if (page > 2)
     {
       (void) FormatMagickString(buffer,MaxTextExtent,
-        "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
-        (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+        "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+        (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),(long)
+        floor(bounds.y2+0.5));
       (void) WriteBlobString(image,buffer);
       (void) FormatMagickString(buffer,MaxTextExtent,
         "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
diff --git a/coders/ps2.c b/coders/ps2.c
index b373d28..76c78bd 100644
--- a/coders/ps2.c
+++ b/coders/ps2.c
@@ -531,9 +531,9 @@
     (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
       &geometry.width,&geometry.height);
     scale.x=(double) (geometry.width*delta.x)/resolution.x;
-    geometry.width=(unsigned long) (scale.x+0.5);
+    geometry.width=(unsigned long) floor(scale.x+0.5);
     scale.y=(double) (geometry.height*delta.y)/resolution.y;
-    geometry.height=(unsigned long) (scale.y+0.5);
+    geometry.height=(unsigned long) floor(scale.y+0.5);
     (void) ParseAbsoluteGeometry(page_geometry,&media_info);
     (void) ParseGravityGeometry(image,page_geometry,&page_info,
       &image->exception);
@@ -580,9 +580,9 @@
         else
           {
             (void) FormatMagickString(buffer,MaxTextExtent,
-              "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
-              (long) (bounds.y1+0.5),
-              (long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+              "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+              (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),(long)
+              floor(bounds.y2+0.5));
             (void) WriteBlobString(image,buffer);
             (void) FormatMagickString(buffer,MaxTextExtent,
               "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
@@ -1093,8 +1093,9 @@
   if (page > 1)
     {
       (void) FormatMagickString(buffer,MaxTextExtent,
-        "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
-        (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+        "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) ceil(bounds.x1-0.5),
+        (long) ceil(bounds.y1-0.5),(long) floor(bounds.x2+0.5),(long)
+        floor(bounds.y2+0.5));
       (void) WriteBlobString(image,buffer);
       (void) FormatMagickString(buffer,MaxTextExtent,
         "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
diff --git a/coders/ps3.c b/coders/ps3.c
index e528233..4a2d478 100644
--- a/coders/ps3.c
+++ b/coders/ps3.c
@@ -952,9 +952,9 @@
     (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
       &geometry.width,&geometry.height);
     scale.x=(double) (geometry.width*delta.x)/resolution.x;
-    geometry.width=(unsigned long) (scale.x+0.5);
+    geometry.width=(unsigned long) floor(scale.x+0.5);
     scale.y=(double) (geometry.height*delta.y)/resolution.y;
-    geometry.height=(unsigned long) (scale.y+0.5);
+    geometry.height=(unsigned long) floor(scale.y+0.5);
     (void) ParseAbsoluteGeometry(page_geometry,&media_info);
     (void) ParseGravityGeometry(image,page_geometry,&page_info,
       &image->exception);
diff --git a/coders/svg.c b/coders/svg.c
index a65a526..b9a8338 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -2114,8 +2114,8 @@
           if ((svg_info->view_box.width == 0.0) ||
               (svg_info->view_box.height == 0.0))
             svg_info->view_box=svg_info->bounds;
-          svg_info->width=(unsigned long) (svg_info->bounds.width+0.5);
-          svg_info->height=(unsigned long) (svg_info->bounds.height+0.5);
+          svg_info->width=(unsigned long) floor(svg_info->bounds.width+0.5);
+          svg_info->height=(unsigned long) floor(svg_info->bounds.height+0.5);
           MVGPrintf(svg_info->file,"viewbox 0 0 %lu %lu\n",svg_info->width,
             svg_info->height);
           sx=(double) svg_info->width/svg_info->view_box.width;
diff --git a/coders/tiff.c b/coders/tiff.c
index 807c127..7144149 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -949,8 +949,8 @@
     y_position=(float) image->page.y/y_resolution;
     (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position);
     (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position);
-    image->page.x=(long) (x_position*x_resolution+0.5);
-    image->page.y=(long) (y_position*y_resolution+0.5);
+    image->page.x=(long) ceil(x_position*x_resolution-0.5);
+    image->page.y=(long) ceil(y_position*y_resolution-0.5);
     image->orientation=(OrientationType) orientation;
     chromaticity=(float *) NULL;
     (void) TIFFGetField(tiff,TIFFTAG_WHITEPOINT,&chromaticity);
diff --git a/coders/txt.c b/coders/txt.c
index 30d29a6..7d78b97 100644
--- a/coders/txt.c
+++ b/coders/txt.c
@@ -223,9 +223,10 @@
   /*
     Initialize Image structure.
   */
-  image->columns=(unsigned long) (((page.width*image->x_resolution)/
+  image->columns=(unsigned long) floor(((page.width*image->x_resolution)/
     delta.x)+0.5);
-  image->rows=(unsigned long) (((page.height*image->y_resolution)/delta.y)+0.5);
+  image->rows=(unsigned long) floor(((page.height*image->y_resolution)/
+    delta.y)+0.5);
   image->page.x=0;
   image->page.y=0;
   texture=(Image *) NULL;
@@ -252,7 +253,7 @@
   status=GetTypeMetrics(image,draw_info,&metrics);
   if (status == MagickFalse)
     ThrowReaderException(TypeError,"UnableToGetTypeMetrics");
-  page.y=(long) (page.y+metrics.ascent+0.5);
+  page.y=(long) ceil(page.y+metrics.ascent-0.5);
   (void) FormatMagickString(geometry,MaxTextExtent,"0x0%+ld%+ld",page.x,page.y);
   (void) CloneString(&draw_info->geometry,geometry);
   (void) CopyMagickString(filename,image_info->filename,MaxTextExtent);
diff --git a/coders/xps.c b/coders/xps.c
index a6dd479..51a347c 100644
--- a/coders/xps.c
+++ b/coders/xps.c
@@ -248,8 +248,8 @@
     /*
       Set XPS render geometry.
     */
-    width=(unsigned long) (bounds.x2-bounds.x1+0.5);
-    height=(unsigned long) (bounds.y2-bounds.y1+0.5);
+    width=(unsigned long) floor(bounds.x2-bounds.x1+0.5);
+    height=(unsigned long) floor(bounds.y2-bounds.y1+0.5);
     if (width > page.width)
       page.width=width;
     if (height > page.height)
@@ -279,8 +279,9 @@
     (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
   if (image_info->page != (char *) NULL)
     (void) ParseAbsoluteGeometry(image_info->page,&page);
-  page.width=(unsigned long) (page.width*image->y_resolution/delta.x+0.5);
-  page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
+  page.width=(unsigned long) floor(page.width*image->y_resolution/delta.x+0.5);
+  page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+
+    0.5);
   (void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",
     page.width,page.height);
   image=DestroyImage(image);