Image resize tool with “auto-center” feature [closed]

Solution 1:

You can do that (and much more) with ImageMagick. With ImageMagick installed, type this on your command line / shell (replace arguments to your need):

 convert input.jpg -resize 80x80 -size 80x80 \
    xc:blue +swap -gravity center -composite output.jpg

This resizes the image to fit within a "canvas" of 80x80 pixels, centers the image and fills the background blue (blue was only chosen as an example).

ImageMagick is available for several (most?) OSes.


Folder processing

If you're working in Unix-like environment (Linux, BSD etc - even Mac), you can execute the aforementioned command through find, which enables you to process folders etc:

find /path/to/my/folder -iname "*.jpg" -exec \
    convert {} -resize 80x80 -size 80x80 \
    xc:blue +swap -gravity center -composite {}_resized.jpg \;