Page 1 of 1

Two problems, order and tile

Posted: 2010-04-15T05:07:23-07:00
by theelf
Hi, first sorry my english, and i make the post long, but i dont know how to write in english in a short way...

First problem resolved, thanxs fmw42 for the help
I use imagemagick (windows) to cut a number of images (SPRITE1.BMP, SPRITE2.BMP..etc) in small 32x32 pieces, and then make one image of all

Code: Select all

mogrify -crop 32x32 *.bmp
works perfect, but i have a problem, the output is

Code: Select all

sprite1-0.BMP, sprite1-1.BMP ..... sprite1-11.BMP
sprite2-0.bmp... sprite2-12.bmp

etc etc
When i need to make one image of all, i use the command montage (if i have 32 images)

Code: Select all

montage -geometry +0+0 -tile 32x1 *.bmp out.bmp
The problem here is that the order is incorrect, montage order in this way

Code: Select all

sprite1-0, sprite1-1, sprite1-10, sprite1-2, sprite1-20... etc
when i need to order, that sprite 1-10 is after sprite1-9.. [/size]



The second problem, is in montage command, i need to define "-tile 32x1" to make one big image from my 32 images in one row and 32 columns. But there this is not very comfortable, because i need to make a batch, and always i have different number of images,

there is a automatic way to tell montage the tile comand, like " -tile *x1 "


Thanxs for your help

Re: Two problems, order and tile

Posted: 2010-04-15T07:53:02-07:00
by theelf
I reply myself. If i make a txt with all images
dir /B /ON *.bmp >list.txt
I have this
sprite1-0.bmp
sprite1-1.bmp
sprite1-10.bmp
sprite1-11.bmp
sprite1-12.bmp
sprite1-13.bmp
sprite1-14.bmp
sprite1-15.bmp
sprite1-16.bmp
sprite1-17.bmp
sprite1-18.bmp
sprite1-19.bmp
sprite1-2.bmp
sprite1-20.bmp
Maybe is a windows problem? i read that XP and up, order in a logical format (10 is bigger than 2)

Using dir command i can order by time creation, but dont work, because i think imagemagick first create sprite1-10.bmp than sprite1-2.bmp, or i mistake?

Re: Two problems, order and tile

Posted: 2010-04-15T10:03:12-07:00
by fmw42
try

mogrify -format %02d.bmp -crop 32x32 *.bmp

works on unix to add a leading zero to the numbers

Re: Two problems, order and tile

Posted: 2010-04-15T13:05:14-07:00
by theelf
try

mogrify -format %02d.bmp -crop 32x32 *.bmp

works on unix to add a leading zero to the numbers
...and works on windows too, thanxs so mucho for your help! save my day.

I try a lot of complicated things, and this solution is very simple :D



Now, if someone can help me with the second problem..THANXS in advance

Re: Two problems, order and tile

Posted: 2010-04-15T19:08:37-07:00
by fmw42
not sure I understand, but you can specify x1 rather than 32x1. see http://www.imagemagick.org/Usage/montage/#tile

P.S. If you don't need the virtual canvas as I suspect you don't when you go to put them all in one row or one column, then you should remove the virtual canvas (or the montage may not work right), by doing

mogrify -format %02d.bmp -crop 32x32 +repage *.bmp