List Info

Thread: input filename equals output filename




input filename equals output filename
user name
2005-12-22 19:14:55
I forgot to send message to magick-users list, so I do it
now.


Hi

> /dir/result_1.jpg
> /dir/result_2.jpg
> ...
> /dir/result_n.jpg

> convert -resize 100x100 /dir/*.jpg
/resized/result_%d.jpg

Problem is that shell expands image filenames in wrong order
(it sorts alphabetically,
not numerically), so *.jpg will be expanded in

result_1.jpg result_10.jpg result_11.jpg ... result_19.jpg
result_2.jpg result_20.jpg ...

So you have to convert them separately, for example in loop
(which I think will be a bit slower):

for f in /dir/*.jpg;
do
  convert $f -resize 100x100 /resized/`basename $f`
done

or You have to name all SOURCE images like Anthony said:

/dir/result_001.jpg
/dir/result_002.jpg
...

so shell expands them i correct order AND use
/resized/result%03d.jpg for destination:

convert -resize 100x100 /dir/*.jpg /resized/result_%03d.jpg


Third solution is to copy all files to destination and use
mogrify to convert all files in place.

cp /dir/*.jpg /resized
mogrify -resize 100x100 /resized/*.jpg

If you don't need to keep files in /dir you can of course
skip copying .

Greets

Michal



_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )