How to resize a batch of images on Linux?
Posted on In QAResizing images on Linux with gThumb is easy. However, I have a batch of images inside a folder. Manually resizing them will consume too much time.
How to automatically resize them on Linux with a script?
You can use convert
from ImageMagick together with bash script to resize images inside a directory.
mkdir resize;
IFS=$(echo -en "nb");
for i in *; do
echo $i; convert $i -resize 600^ resize/$i;
done
The script will make a new directory named “resize” in current directory, resize all images in current directory to smaller ones of width 600px, and store the resized images into “reisze”.
The line IFS=$(echo -en "nb")
is a bash trick to handle situations where images file names have spaces.
Thanks but this does a shit job of handling file names with spaces