Join various images to one image based on list!!

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Cauptain
Posts: 5
Joined: 2017-08-05T02:45:55-07:00
Authentication code: 1151

Join various images to one image based on list!!

Post by Cauptain »

Guys, I'd like some help.

I have 3 pictures: a.jpg - b.jpg e c.jpg

I want to join all in one photo, like d.jpg = abc.jpg

I know how to do it. I want to know if it works a list with the images (a folder with 30 images or more of each) if it is possible to do.

My images are in the folder.

Image

Any help is very appreciated.


Claudio
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Join various images to one image based on list!!

Post by fmw42 »

Please always provide your IM version and Platform. Syntax may vary.

If you make a text file listing 3 image per row, then it can be done by reading the file row by row and extracting the 3 image in the row to combine them. But this is scripting and that would depend upon your OS.
Cauptain
Posts: 5
Joined: 2017-08-05T02:45:55-07:00
Authentication code: 1151

Re: Join various images to one image based on list!!

Post by Cauptain »

Sorry fmw42. I will remember this in the future.

Windows 10 and last version of ImageMagick (ImageMagick-7.0.7-28-Q16-x64-dll.exe).



Claudio
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Join various images to one image based on list!!

Post by fmw42 »

I could do it in Unix, but do not know windows scripting. So perhaps one of the Windows experts can help you on this. It might help if you post a short file with a few rows of your images for experimenting and showing you how to do it.
Cauptain
Posts: 5
Joined: 2017-08-05T02:45:55-07:00
Authentication code: 1151

Re: Join various images to one image based on list!!

Post by Cauptain »

I can install Unix on Windows 10 and try your script. No problem for me.


Claudio
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Join various images to one image based on list!!

Post by fmw42 »

Cauptain wrote: 2018-04-24T02:10:50-07:00 I can install Unix on Windows 10 and try your script. No problem for me.
Claudio
You say:
I have 3 pictures: a.jpg - b.jpg e c.jpg

I want to join all in one photo, like d.jpg = abc.jpg

But I am not sure how you want to combine them. Also what is e?

If I assume you just want to append them side-by-side, then you can do it like this.

Image File:
http://www.fmwconcepts.com/misc_tests/c ... gefile.txt

Contents:
lena.jpg spacer.jpg mandril3.jpg
mandril3.jpg spacer.jpg zelda1.jpg
zelda1.jpg spacer.jpg lena.jpg

Input:
Image

Image

Image

Image

Code: Select all

i=0
while read img1 img2 img3; do 
convert $img1 $img2 $img3 +append result$i.jpg
i=$((i+1))
done < imagefile.txt
Results:
Image

Image

Image


Note: your file names have spaces in them. So you must enclose them in double quotes in your text file; otherwise, it will try to read each part of the name as a separate file, since the space is the delimiter for the read command. There are ways to get around that by setting the Internal Field Separator to something else, such as a comma or tab. But I won't go into detail unless you say the quoting won't work for you.
Post Reply