Merging Images

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
AntonioKovacevic
Posts: 4
Joined: 2015-05-22T02:43:28-07:00
Authentication code: 6789

Merging Images

Post by AntonioKovacevic »

Hello people.

I am new to the ImageMagic and I require your help. I have a folder of images 0-9_0-13.jpg. First number is column and second one is a row.
I'm using this command to merge those images together:

Code: Select all

E:\315\001_files\12>montage.exe -tile 1x14 [0-9]_[0-13].jpg miff:- | convert.exe - +append final.jpg
The image comes out all scrambled. The image should look like this:

Code: Select all

0x0   1x0   2x0 ... 9x0
0x1   1x1   2x1 ... 9x1
0x2   1x2   2x2 ... 9x2 
...   ...   ...   .
0x13  1x13  2x13   9x13
If anyone could help me I will greatly appreciate it.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Merging Images

Post by snibgo »

I think montage will find the files in lexicographical (dictionary) order: 0_0.jpg, 0_1.jpg etc. Is that the order they come out?
snibgo's IM pages: im.snibgo.com
AntonioKovacevic
Posts: 4
Joined: 2015-05-22T02:43:28-07:00
Authentication code: 6789

Re: Merging Images

Post by AntonioKovacevic »

This is the result of the above mentioned command: https://dl.dropboxusercontent.com/u/11218705/final.jpg
And this is the result of this command: https://dl.dropboxusercontent.com/u/112 ... inal_1.jpg

Code: Select all

montage -tile 1x10 [0-9]_[0-9].jpg miff:- | convert - +append final.jpg
I guess this only works if image is 1:1 ratio, ignoring the spacing between images.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Merging Images

Post by snibgo »

Your results support my theory. In dictionary order: 0, 1, 11, 12, 13, 2, 3, 4, ...

You should use numbers with leading zeros: 00, 01, 02, ... 09, 10, 11, 12, 13.
snibgo's IM pages: im.snibgo.com
AntonioKovacevic
Posts: 4
Joined: 2015-05-22T02:43:28-07:00
Authentication code: 6789

Re: Merging Images

Post by AntonioKovacevic »

File names go 00x00, 02x05, 09x11.. I get an error No such file or directory. What am I doing wrong?
AntonioKovacevic
Posts: 4
Joined: 2015-05-22T02:43:28-07:00
Authentication code: 6789

Re: Merging Images

Post by AntonioKovacevic »

Thank you. This command worked:

Code: Select all

montage.exe -mode concatenate -tile 1x14 [0-9]*_[0-9]*.jpg miff:- | convert.exe - +append final.jpg
Anybody knows a way to bulk rename files from X_Y to X_0Y, if the second number is not bigger than 10? BulkRenameUtility + RegEx maybe?

Figured it out

Code: Select all

(\d{1})_(\d{1}).jpg
\1_0\2
Post Reply