Resizing image files ¶
mogrify command ¶
Resize all JPEGs in a directory
This command requires the imagemagick libraries and will resize all files with the .JPG extension to a width of 800 pixels and will keep the same proportions as the original image.
mogrify -resize 800 *.JPG
google picasa use case ¶
cp *.JPG web
cd web
mogrify -resize 800 *.JPG
date; google picasa -d "2011-10-27" -n "Minou et Ali à Annecy le 27 octobre 2011" -t "Annecy, 27 octobre 2011" create "Annecy, 27 octobre 2011" *.JPG; date
Script bash : how to shrink a list of jpg files with the ‘convert’ command ¶
1#!/usr/bin/env bash
2# The image size_max will be 800
3
4size_max=800
5mkdir ${size_max}
6
7for filename in *.jpg; do
8 input=${filename}
9 name=${filename%.*}
10 suffixe=${filename##*.}
11 output="800/"${name}_${size_max}.${suffixe}
12 echo "Input: ${input}"
13 echo "File Name: ${name}"
14 echo "File Extension: ${suffixe}"
15 echo "output: ${output}"
16
17 convert ${input} -resize ${size_max} ${output}
18done