Tuesday, November 06, 2007

Resize and Scaling using ImageMagick

ImageMagick default filter for resizing and scale,
'Mitchell' for enlargement, and for shrinking images involving transparency
'Lanczos' for shrinking when no-transparency is involved
Lanczos resampling

Down-sampling examples
Down-sampling methods

Examples,
MinGW MSYS, Cygwin, GOW (Gnu on Windows)

convert command line options
ImageMagick Usage: basic

find . -maxdepth 1 -name "*.JPG" -exec convert '{}' -strip -resize 1920x1080 HD/'{}' \;
convert img.png -rotate 270 img.jpg
identify -verbose img.jpg

convert img.svg -strip -bordercolor white -border 145x0 img.png

# pdf scanned dpi, fax group4 compression is better for black and white
convert -trim -density 300 doc.pdf doc.png
convert -trim -density 300 -compress group4 doc.pdf doc.tiff

adaptive-resize will sharpen the image
convert img.jpg -strip -adaptive-resize image.jpg

strip all exif mata data
mogrify -strip imagename.jpg

using GOW,

gfind 20?? -type d -exec mkdir -p "1600x1200/{}" ;
gfind 20?? -iname "*.jpg" -exec convert "{}" -strip -adaptive-resize 1600x1200 "1600x1200/{}" ;

IM usage under Windows
Batch processing a (sub-)directory tree
bulk processing using IrfanView batch processing

No comments: