Recursively Find Images, Convert to JPEGS and Delete

find . -name '*'.tiff -exec bash -c "mogrify -format jpg -quality 85 -resize 75% {} && rm {}" \;
Simple command to convert a large number of images into jpeg-format. Will delete originals after conversion.

2009-08-10 18:27:10

What Others Think

You could use xargs to mogrify multiple files in parallel since resizing is likely CPU-bound: find . -name '*'.tiff | xargs -n 1 -P $NCPUS -I {} bash -c "mogrify -format jpg -quality 85 -resize 75% {} && rm {}" where $NCPUS is how many parallel versions of mogrify to run.
bwoodacre · 666 weeks ago
Converting the file to a graphic file format is not always a good idea. If you need to use the PDF for printing or editing, then converting to another format will result in lost information and ultimately make your document useless. Visit source to download beautiful heart templates. On the other hand, if you just want to view or share your document with someone else, then converting it into a graphic format might be just what you need. This will allow you to save it as an image or send it via email directly from your browser without having to worry about compatibility issues.
Jadyn11 · 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: