I have around 2500 images. Some of them contains border while others arent. What I want to accomplish is to add border to the ones that doesn't have any.
Images with border are 64x64
and images without border are 56x56
I prepared a border image file with size of 64x64
in PNG format and I want to merge all files without border within this image to get them borders and output them as PNG format aswell.
I have tried several ways using ImageMagic
but no luck so far.
CodePudding user response:
If you make a 64x64 lime-magenta gradient as background.png
and a solid blue 56x56 image as foreground.png
like this:
magick -size 64x64 gradient:lime-magenta background.png
magick -size 56x56 xc:blue foreground.png
Your command to paste the foreground into the centre of the background is as simple as:
magick -gravity center background.png foreground.png -composite result.png
CodePudding user response:
I figured out it's pretty doable with convert
tool from the ImageMagick package.
First I extracted all images with size of 56x56
to different location, then I did the following;
I added 4 pixels on each side since my border is 64x64
for image in ICO_*.png; do
convert -page 0 0 border.png \
-page 4 4 $image \
-background none -layers merge repage $image-withBorder.png
done