Wednesday, August 24, 2016

Mass resize photos in Linux with ffmpeg

To resize multiple photos at once, you can run this command line:

+ Resize To 1/10 its original size:

$ for filename in /path/to/*.jpg; do ffmpeg -i "$filename" -y -vf scale=iw*.1:ih*.1 "$filename";done

with:

  • iw: input width
  • ih: input height
+ Keep the aspect ratio, we need to specify only one component, either width or height, and set the other component to -1:

$ for filename in /path/to/*.jpg; do ffmpeg -i "$filename" -y -vf scale=250:-1 "$filename";done