Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does anybody know of a tool that can resize an image and automatically center it on it's new dimension?

Example, I have a 200x300 image, I wanted to resize it to 300x300 putting whitespace of 50px on both the right and left sides.

I'm using FastStone Photo Resizer, it works as I wanted including resizing multiple folders at once but it doesn't have that "auto-center" capability.

share|improve this question
1  
What OS are you on, that may be helpful to get answers. –  nerdwaller Nov 26 '12 at 23:42
add comment

3 Answers

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 \;
share|improve this answer
add comment

There is a commandline tool primary intended on batchjobs for complete folders.

scaling images
bumscaleimage [sourcefile] [destfile] [width] [height] [quality] [withoutBorders] [backgroundcolor]
 [sourcefile]   JPG oder Bitamp
 [destfile]     JPG oder Bitamp (Pfad muss nicht existieren)
 [width] in pixels
 [height] in pixels
 [quality] optional default=92 for jpg
 [withoutBorders] optional default=1 0 for borders
    without borders means set possibly only high OR width will be reached
 [backgroundcolor] optional default=$ffffff im angegebenen Format

[sourcefile] also can be used with folder\*.ext , destination than has to be a folder


example
C:\Bilder\Noemi\DSCF0001.JPG C:\test.jpg 100 100 92 0 $ff0000
C:\Bilder\Noemi\*.JPG C:\Zielverzeichnis 100 100 92 0 $ff0000

Freeware for non comercial use
share|improve this answer
add comment

CropSize may be an option, it has this feature and many more... http://forge.zeunic.com/development/2013/cropsize-bulk-image-resize-and-cropping

share|improve this answer
1  
Can you include some of the details from that post in your answer? Just providing links is discouraged, see the FAQ(www.superuser.com/faq). –  slm Mar 27 '13 at 1:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.