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

前端 未结 6 1397
栀梦
栀梦 2020-12-23 10:15

I have multiple images stored in a set of organized folders. I need to re-size those images to a specific percentage recursively from their parent directory

6条回答
  •  余生分开走
    2020-12-23 10:24

    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%
    

提交回复
热议问题