How-to convert multiple image files in Linux
You have a folder with hundreds or thousands of image files that you wish to convert into another image file format? And you don't want to open them one by one, click on "save as", choose the new file format and confirm everything with "save" and "close"?
Fortunately, the Linux terminal has everything for batch converting, resizing and editing your image files!
Convert and resize all *.jpg images to *.png thumbnails
This will convert and resize all *.jpg images in the current directory to *.png images. Perfect for creating smaller thumbnails in large image directories. See the Linux manual pages "man bash", "man find", "man read", "man convert" and "man sed".
All filename results from find are piped line by line to read and then processed by convert, editing the new filename with sed. This ensures that all paths with whitespace characters are processed correctly.
find . -type f -name '*.jpg' | while read filename; do echo "converting ${filename}"; convert -size 128x128 -resize 128x128 +profile '*' "${filename}" "`echo "${filename}" | sed -e 's/\.jpg$/\.png/'`"; done
