0

I am trying to add a title to a figure using Image magick.

convert montage2.png -gravity North -pointsize 100 -annotate +0-100 "Label" montage2.png

Unfortunately, "Label" is outside the image. How can I expand the image to show it? The figure content is already at the top border. So the image has to be expanded to cover it. I want a title on top of the two panels A and B. But the text is getting cropped ("label getting cropped"). The original images do not have enough space on top. Any way to expand? Is there any option to do that? I am looking here https://imagemagick.org/script/convert.php but can't figure out.

enter image description here

BND
  • 612
  • 1
  • 13
  • 23
  • Please show the image you start with and give some indication of what you want as a result. Thank you. – Mark Setchell Nov 02 '20 at 11:26
  • I still have no idea what you are trying to do, despite the diagram. Maybe have a read here and see if that helps... https://stackoverflow.com/a/55470441/2836621 – Mark Setchell Nov 02 '20 at 13:21

1 Answers1

0

In Imagemagick you can extend the image or pad it by some amount on top and bottom if you want.

convert image -bordercolor white -border 0x20 result

See https://imagemagick.org/Usage/crop/#border


This will add a 20 px white border to the top and bottom

Alternately, you can write your titles using label: to create new images and append them on the top and/or bottom. See https://imagemagick.org/Usage/annotating/

fmw42
  • 46,825
  • 10
  • 62
  • 80
  • The first command did. I actually merged both ```convert montage2.png -bordercolor white -border 0x20 -gravity North -pointsize 100 -annotate +0-100 "Label" montage2.png ``` – BND Nov 02 '20 at 17:52