diff --git a/coders/caption.c b/coders/caption.c index f86d679cee..b63bbf8c28 100644 --- a/coders/caption.c +++ b/coders/caption.c @@ -316,8 +316,10 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info, caption=DestroyString(caption); (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g", (draw_info->direction == RightToLeftDirection ? (double) image->columns- - metrics.bounds.x2 : metrics.bounds.x1),(draw_info->gravity == - UndefinedGravity ? MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0)); + (draw_info->gravity == UndefinedGravity ? metrics.bounds.x2 : 0.0) : + (draw_info->gravity == UndefinedGravity ? metrics.bounds.x1 : 0.0)), + (draw_info->gravity == UndefinedGravity ? + MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0)); (void) CloneString(&draw_info->geometry,geometry); status=AnnotateImage(image,draw_info); if (image_info->pointsize == 0.0) diff --git a/coders/label.c b/coders/label.c index b0dc77952d..ce1e721dbb 100644 --- a/coders/label.c +++ b/coders/label.c @@ -280,8 +280,10 @@ static Image *ReadLABELImage(const ImageInfo *image_info, */ (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g", (draw_info->direction == RightToLeftDirection ? (double) image->columns- - metrics.bounds.x2 : metrics.bounds.x1),(draw_info->gravity == - UndefinedGravity ? MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0)); + (draw_info->gravity == UndefinedGravity ? metrics.bounds.x2 : 0.0) : + (draw_info->gravity == UndefinedGravity ? metrics.bounds.x1 : 0.0)), + (draw_info->gravity == UndefinedGravity ? + MagickMax(metrics.ascent,metrics.bounds.y2) : 0.0)); (void) CloneString(&draw_info->geometry,geometry); status=AnnotateImage(image,draw_info); if (image_info->pointsize == 0.0)