Page 1 of 1

Stroke around output

Posted: 2016-11-22T13:46:25-07:00
by pctechtv
I have an ImageMagick command I use like so.

Code: Select all

magick -density 72 "C:\ExamplePDF\MyPDF.pdf"[0] -crop %[w]x%[fx:w/16*9]+0+0 +repage -resize 765x430 "C:\ExampleJPG\MyJPG.jpg"
I am wondering if it is possible to get a stroke around my jpeg output like so (pic). If so could someone show me the command. Thanks
Image

Re: Stroke around output

Posted: 2016-11-22T13:49:47-07:00
by fmw42

Code: Select all

convert image -bordercolor black -border 2 result
see http://www.imagemagick.org/Usage/crop/#border

Re: Stroke around output

Posted: 2016-11-22T14:54:17-07:00
by GeeMack
pctechtv wrote:I am wondering if it is possible to get a stroke around my jpeg output like so (pic). If so could someone show me the command.
If you want to add a border without changing the existing dimensions of the image you can "-shave" it first to reduce the image size by the border size. Then add the border. Use the same amount for both the "-shave" and the "-border" like this...

Code: Select all

magick input.jpg -bordercolor blue -shave 3x3 -border 3x3 output.jpg
The output image there will be the same dimensions as the input image.

Re: Stroke around output

Posted: 2016-11-22T15:07:05-07:00
by pctechtv
I am not getting any of the examples to work. It is making ask the question if I am on Windows and run the "convert" command could I be not in ImageMagicks context. I keep getting errors like

Code: Select all

Invalid Parameter - -bordercolor
whine I use the command like this

Code: Select all

convert 'D:\161122 TempCodePic\Test2.jpg' -bordercolor black -border 2 'D:\161122 TempCodePic\Test3.jpg'
I even saw other examples using it like this

Code: Select all

convert -bordercolor red -border 10 "D:\161122 TempCodePic\Test2.jpg" "D:\161122 TempCodePic\Test3.jpg" 
but still get the error. Thanks

Re: Stroke around output

Posted: 2016-11-22T15:12:28-07:00
by pctechtv
When I use it with the "magick" command instead of "convert" it works. I would like to know what is going on here. However it does do EXACTLY what I was trying to do. Thank you @fmw42 and @GeeMack

Re: Stroke around output

Posted: 2016-11-22T15:20:33-07:00
by GeeMack
pctechtv wrote:I am not getting any of the examples to work. It is making ask the question if I am on Windows and run the "convert" command could I be not in ImageMagicks context. I keep getting errors like

Code: Select all

Invalid Parameter - -bordercolor
There is a Windows program named "convert.exe", and your command was calling that program. Since you have ImageMagick 7 you'll probably want to use "magick" instead anyway.