Convert multiple files for the same code

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
Doomme
Posts: 3
Joined: 2016-03-31T10:57:02-07:00
Authentication code: 1151

Convert multiple files for the same code

Post by Doomme »

Hi guys,

I'm a newbie. I don't know how to coding, and i'm using imagemagick in window x64.
So, please make the answer clear and easy to understand, thanks!

Here is my question,
i have 3000 images (They are 1500 pages of the ebook) and that are the same size. I need to combine them in pairs, putting them side-by-side.
I find the same question in stackoverflow forum, this link:
http://stackoverflow.hex1.ru/questions/ ... ook-layout ,
im trying to now what is bash, try to install nuget....But i don't know how to coding so i can't handle it.
I'm lucky to find this code:

Code: Select all

convert myfile1.jpg myfile2.jpg +append Done1.jpg
to combine 2 photos, and it was amazing so far.
But it only handle 1 command with 2 photos,
Is there anyway to automate this using imageMagick in window? with easy use code?
i lost 2 days to find answer my own, but i can't find any thing

Regards!
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Convert multiple files for the same code

Post by GeeMack »

Doomme wrote:I'm lucky to find this code:

Code: Select all

convert myfile1.jpg myfile2.jpg +append Done1.jpg
to combine 2 photos, and it was amazing so far.
But it only handle 1 command with 2 photos,
Is there anyway to automate this using imageMagick in window? with easy use code?!
I'm using Windows 7 64 and ImageMagick 6.9.3-6 Q16 x64. Try this...

Code: Select all

montage *.jpg -tile 2x1 -geometry +0+0 Done%04d.jpg
EDITED TO ADD: Also, if the dimensions are all the same, or if you will resize all the images to an exact dimension, something like this should work...

Code: Select all

convert *.jpg -resize 640x480! +append -crop 1280x480 Done%04d.jpg
That brings in all the JPG files in the directory and resizes them all to 640x480 just to make sure they are all the exact same size. Then it appends them into a wide horizontal strip of all the images. Then it crops that strip into separate images which are 1280 pixels, twice the width of the input images. Finally it outputs them as individually named JPG files "Done0000.jpg", "Done0001.jpg", "Done0002.jpg", etc.
Doomme
Posts: 3
Joined: 2016-03-31T10:57:02-07:00
Authentication code: 1151

Re: Convert multiple files for the same code

Post by Doomme »

Firstly, thank you!
That's exactly what i want, but i have some issue with this code:

With 8 image, it work totally perfect.
Image

But when im apply for a hundred photos, it's gonna combine like this:
Image

I thought that, Your code work only with photo contain number smaller than 9.

I'm waiting for your respond,
Thanks!
(I'm using Windows 10 64 and ImageMagick 6.9.3-7 Q16 x64).
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert multiple files for the same code

Post by snibgo »

Your input filles have names like RHModern1.jpg, RHModern2.jpg, RHModern10.jpg, and so on. You need leading zeroes so the sort order is what you want: RHModern001.jpg, RHModern002.jpg, RHModern010.jpg, etc.
snibgo's IM pages: im.snibgo.com
Doomme
Posts: 3
Joined: 2016-03-31T10:57:02-07:00
Authentication code: 1151

Re: Convert multiple files for the same code

Post by Doomme »

snibgo wrote:Your input filles have names like RHModern1.jpg, RHModern2.jpg, RHModern10.jpg, and so on. You need leading zeroes so the sort order is what you want: RHModern001.jpg, RHModern002.jpg, RHModern010.jpg, etc.
Offcourse, you're right!

@snibgo; @GeeMack, you guys saved my day, Thank you so much!
Post Reply