"how to batch resize images in ubuntu recursively within the terminal?" Code Answer

1

you could use imagemagick. for instance, for resizing all the jpg images under the current directory to 50% of their original size, you could do:

for f in `find . -name "*.jpg"`
do
    convert $f -resize 50% $f.resized.jpg
done

the resulting files will have ".jpg" twice in their names. if that is an issue, you can check the following alternatives.

for traversing/finding the files to resize, you can use xargs too. example:

find . -name "*.jpg" | xargs convert -resize 50%

this will create copies of the images. if you just want to convert them in place, you can use:

find . -name "*.jpg" | xargs mogrify -resize 50%
By dedek on August 13 2022

Answers related to “how to batch resize images in ubuntu recursively within the terminal?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.