Quick tip: Batch resize and convert images in Linux
You can batch resize and convert images in Linux from the terminal using ImageMagick. The first step is to install ImageMagick. You can download the ImageMagick from the ImageMagick homepage or ImageMagick is widely available in the repositories and can be downloaded using apt-get install imagemagick.
There are a ton of commands available from the ImageMagick guide. I will walk you through the most commonly used commands: resize, convert, and quality (compression).
Enter the following command to resize all JPEG images in a directory to 750×500 pixels. Obviously, you can change the 750×500 to whatever dimensions you prefer:
convert -resize 750×500 *.jpg
Enter the following command to convert a JPEG into a GIF. You can convert any format image, it doesn’t have to just be JPEG to GIF:
convert image.jpg newImage.gif
Enter the following command to reduce the quality of every JPEG in a directory down to 80%. You can change the 80% to whatever percentage you prefer:
convert -quality 80% *.jpg
Please visit the ImageMagick homepage to learn about the thousands of other commands available.
Note: You can also combine commands. For example:
convert -resize 750×500 -quality 80% *.jpg