2

In Crop and resize image to fit a5 pdf I asked how to fit an image in a landscape A5.

Now I'd like to add a border or frame for the image and a tagline in the bottom (between the bottom line and the image).

Is this possible using ImageMagikc?

Juanjo Conti
  • 2,723
  • Types of borders I'm thinking of: https://i.stack.imgur.com/ZmI9O.jpg, https://i.stack.imgur.com/aeNfO.png, https://i.stack.imgur.com/YqrfN.png – Juanjo Conti Apr 30 '17 at 15:20

1 Answers1

2

You can do that with the help of the -draw operator:

convert in.png -fill none -stroke black -strokewidth ${WIDTH} -draw "rectangle ${X1},${Y1} ${X2},${Y2}" out.png

where: WIDTH - stroke width
X1 - x coordinate of the top left corner
Y1 - y coordinate of the top left corner
X2 - x coordinate of the bottom right corner
Y2 - y coordinate of the bottom right corner

So e.g. for your other image that you want to crop+resize+convert to PDF you could run:

convert out.png -resize 2362x1630 -background white -gravity center -extent 2480x1748 \
-fill none -stroke black -strokewidth 10 -draw "rectangle 20,20 2460,1728" out.pdf
don_crissti
  • 82,805