From d3d96f05950275b916207bf9df03640ef3e9fd6e Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Sun, 6 Oct 2019 09:31:02 -0400
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1725

---
 magick/geometry.c | 8 ++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
 
diff --git a/magick/geometry.c b/magick/geometry.c
index 27f99f8438..101810ca5e 100644
--- a/magick/geometry.c
+++ b/magick/geometry.c
@@ -1423,13 +1423,13 @@ MagickExport MagickStatusType ParseMetaGeometry(const char *geometry,ssize_t *x,
       if (geometry_ratio >= image_ratio)
         {
           *width=former_width;
-          *height=(size_t) floor((double) (former_height*image_ratio/
-            geometry_ratio)+0.5);
+          *height=(size_t) floor((double) (PerceptibleReciprocal(
+            geometry_ratio)*former_height*image_ratio)+0.5);
         }
       else
         {
-          *width=(size_t) floor((double) (former_width*geometry_ratio/
-            image_ratio)+0.5);
+          *width=(size_t) floor((double) (PerceptibleReciprocal(
+            image_ratio)*former_width*geometry_ratio)+0.5);
           *height=former_height;
         }
       former_width=(*width);
