Add an image over an existing one using the ImageMagick command line

I would like to add a series of images to an existing one using the imagemagick command line.

As you can see, this is not just an image addition. I found http://www.imagemagick.org/Usage/compose/ where I could see some examples, but I need to fill in each "block".

I have the exact position where each block starts and ends, I also have a large-scale scale to reduce it.

I think I could use

composite -geometry +31+105 toadd.gif source.gif newfile.jpg 

but this is only one added image, and I need to reduce it.

I was wondering if I can create some rectangles and fill them with my image.

any idea how this can be solved?

+6
source share
1 answer

Converting would be better since you can add images with composite or layers.

Here is a very crude example, and I'll probably start with a longer section of the wall so you can crop it when resizing. There will still be quite a lot of user input to fix the locations, since I click that you do not always have the same number of walls of the same length. I would write code to enter details into the form, since it would be easier than changing the code every time.

 convert k0jbqs.jpg \ ( 313386r.png -thumbnail x25 ) -gravity west -geometry +0+30 -composite \ ( 313386r.png -thumbnail x25 ) -gravity center -geometry +80+30 -composite \ ( 313386r.png -thumbnail x25 ) -gravity east -geometry +0+30 -composite \ output.png 

You will need to rip out the lines, I just added them to read the code.

NOTES: Thumbnail resizes images of bricks; you can forget gravity and just use -geometry, and numbers are positions from the upper left corner and -composition puts a new image on top of the previous image.

+16
source

Source: https://habr.com/ru/post/918432/


All Articles