diff --git a/MagickCore/geometry.c b/MagickCore/geometry.c
index 2f8d9c5..cb87ac1 100644
--- a/MagickCore/geometry.c
+++ b/MagickCore/geometry.c
@@ -1447,7 +1447,8 @@
}
flags=ParseMetaGeometry(geometry,®ion_info->x,®ion_info->y,
®ion_info->width,®ion_info->height);
- if (((flags & PercentValue) != 0) || ((flags & SeparatorValue) == 0))
+ if ((((flags & WidthValue) != 0) || ((flags & HeightValue) != 0)) &&
+ (((flags & PercentValue) != 0) || ((flags & SeparatorValue) == 0)))
{
if ((flags & WidthValue) == 0)
region_info->width=region_info->height;