Hello everybody!
I need help to put two pictures together in a batch processing unit.
The files have the same name and are stored in different directories.
The picture in directory A is 3600x2400 pixel
The picture in directory B is 1683x1274 pixel
The image in directory B should be placed on the image in directory A, with the upper left corner on pixel X: 638 and Y: 584.
And the whole as a batch for over 500 files, consecutively numbered.
I work in a windows environment.
Can someone write me the appropriate command line?
Thank you very much!
how do I put 2 pictures together?
Re: how do I put 2 pictures together?
Alternatively, the images in directory B could be available in the same size as directory A, but only a specific section of image B should be inserted.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how do I put 2 pictures together?
What version of IM? I'll assume v7.
First steps first, which is the image processing. You want to composite one image over another, at a certain offset. Worry about the loop later.
Does that do what you want?
For your extra question, you might need a test on whether the imageB is the same size as imageA, then do:
First steps first, which is the image processing. You want to composite one image over another, at a certain offset. Worry about the loop later.
Code: Select all
magick imageB.png imageA.png -geometry +638+584 -composite out.png
For your extra question, you might need a test on whether the imageB is the same size as imageA, then do:
Code: Select all
magick ( imageB.png -crop {something} +repage ) imageA.png -geometry +638+584 -composite out.png
snibgo's IM pages: im.snibgo.com
Re: how do I put 2 pictures together?
Thank you very much for your answer.
Your first code does exactly what I need.
Can you also tell me how to build a loop?
Your first code does exactly what I need.
Can you also tell me how to build a loop?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how do I put 2 pictures together?
I would use a "for" loop, like this:
For help on "for", type "for /?".
If using in a BAT script, double the percentage signs.
Code: Select all
for /F %F in (directoryA\*) do magick directoryB\%F directoryA\%%F -geometry +638+584 -composite outdir\%F
If using in a BAT script, double the percentage signs.
snibgo's IM pages: im.snibgo.com
Re: how do I put 2 pictures together?
Good evening.
Thanks again for your answers.
I use Windows10 as OS, magick-version = 7.0.8-15
I tried your for-loop in a BAT script, ends in error file cant be found.
Then i tried without /F :
Thanks again for your answers.
I use Windows10 as OS, magick-version = 7.0.8-15
I tried your for-loop in a BAT script, ends in error file cant be found.
Code: Select all
for /F %%F in (.\GreenScreen\umbenannt\*) do magick .\GreenScreen\umbenannt\%%F .\Originals_klein\Ausschnitt\umbenannt\%%F -geometry +638+584 -composite .\NEU\%%F
I tried to google it, this happens because /F cant be used with a wildcard.Die Datei ".\GreenScreen\umbenannt\*" kann nicht gefunden werden.
Then i tried without /F :
There´s a problem with %F, it shows always the full directory, not only the filename.D:\Bilder\2018\Hochzeit_dslrbooth>magick .\GreenScreen\umbenannt\.\GreenScreen\umbenannt\515.jpg .\Originals_klein\Ausschnitt\umbenannt\.\GreenScreen\umbenannt\515.jpg -geometry +638+584 -composite .\NEU\.\GreenScreen\umbenannt\515.jpg
magick: unable to open image '.\GreenScreen\umbenannt\.\GreenScreen\umbenannt\515.jpg': No such file or directory @ error/blob.c/OpenBlob/3490.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how do I put 2 pictures together?
Sorry, yes, remove "/F", and use "%~nxF".
snibgo's IM pages: im.snibgo.com
Re: how do I put 2 pictures together?
Thats it! Thank you very much for your great support!