Help - Search - Members - Calendar
Full Version: Batch Image Conversion
Linuxhelp > Support > Technical Support
OhLordy
I am trying to use the convert command on a batch of images using this piece of code that was given to me

for FILE in 'ls *.jpg'
do
convert -size 120x120 $FILE -resize 120x120 new_$FILE
done

and the errors I get are as follows

convert: Unable to open file (ls) [No such file or directory].
convert: Unable to open file (*.jpg) [No such file or directory].
Segmentation fault

Any help that can be provided would be greatly appreciated. smile.gif
kyoshiro
If its a shell script ( bash ) w/ the extension .sh then there might some errors in the script.

Are you typing ./scriptname.sh file.jpg when you run it?
chrism01
I'd say you need to make sure you are using backquote (aka backtick) marks (`), NOT single quote marks (').
Backticks make the contents a cmd; single quotes just make it a string.
Its an old (quick'n'dirty) shell programming trick to generate a list of files wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.