Re: how to convert 100 bmp files to jpeg?
Star King of the Grape Trees <thestar@fussycoder.id.au> said on Sun, 15 Jan 2006 16:05:42 +1100:
> Serena Cantor wrote:
>
> >I 100 bmp files. I installed gimp and imagemagik, but
> >can't find the way to convert 100 bmp files to jpeg in
> >batch fashion. Do you know the command? Thanks!
> >
> >
> I can't be bothered to consult the man page, but it will be something like:
>
> for $f in `ls *.bmp`; do convert $f --to-jpeg; done
>
> See "man convert" for the precise arguments.
>
> If the files are organized in directories, you may need to use 'find'
> instead of just 'ls'. See man find.
Why on earth would you want to put ls in backticks? I wonder who
originated this rather redundant and fragile (what happens when a
filename has any form of whitespace?) construct? Try googling for
"useless use of cat awards" for another redundant construct that
people love to use.
for f in *.bmp ; do convert $f --to-jpeg ; done
But even better than the above is just:
mogrify -format jpg *.bmp
You can probably also (untested):
convert --to-jpeg *.bmp
Reply to: