How to batch resize images in Ubuntu recursively within the terminal?

Extending the answer from @betabandido

Incase there are spaces in filenames or folder names in which the images are, then one should use -print0 with find and -0 with xargs to avoid any parsing errors.

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

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%

You can also use

sudo apt install imagemagick
sudo apt-get install nautilus-image-converter
nautilus -q

For resizing/rotating images in the current folder. You just install and then right click on an image or multiple ones and choose the size you want and that's it. The nautilus -q is to stop nautilus. Just start nautilus again, and you'll be able to use the image converter.