Marc
Marc

Reputation: 199

Add top and left borders with magick command

Is there a way to add 5 or any number of white/transparent pixels at the top and left borders of an image with the magick command in Linux?

Upvotes: 2

Views: 750

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 208077

Use the -splice operator. First make a solid magenta rectangle:

magick -size 100x50 xc:magenta image.png

Now splice on a yellow chunk (so you can see it) 10 wide and 20 tall:

magick image.png -background yellow -gravity northwest -splice 10x20 result.png

enter image description here

Change yellow to none for transparent pixels.

Change magick to convert for v6 ImageMagick.


If you just want to splice to the East side:

magick image.png -background yellow -gravity east -splice 10x east.png

enter image description here


If you just want to splice to the South side:

magick image.png -background yellow -gravity south -splice x10 south.png

enter image description here

Upvotes: 4

Related Questions