Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have number of images with alpha layer, with different size and aspect ratio. I need to bring them to one size(say 150x150) with maximum possible dimensions keeping alpha and aspect ration. For example - if image is 1500x1000 - then it should be downscaled to 150x100, vertically centered and empty 25px on the top and bottom should be filled with white color. If image is 1000x1500 - then it will be downscaled to 100x150, horizontally centered and empty pixels on the left and right filled with white.

Any tools for this( win or linux)? Thanks

share|improve this question

migrated from serverfault.com May 12 '11 at 13:55

This question came from our site for system and network administrators.

    
This is quite off-topic for SF, but you're looking for something like imagemagick. – jscott May 12 '11 at 13:41

You can use ImageMagick for this sort of conversion, resizing, fill, and much more

The convert tool/command, which is a part of ImageMagick tools, supports -resize, -fill, etc options.

Below are a few links for ImageMagick commands and tutorial:

share|improve this answer

You can try:

GraphicsMagick is the swiss army knife of image processing. Comprised of 267K physical lines (according to David A. Wheeler's SLOCCount) of source code in the base package (or 1,225K including 3rd party libraries) it provides a robust and efficient collection of tools and libraries which support reading, writing, and manipulating an image in over 88 major formats including important formats like DPX, GIF, JPEG, JPEG-2000, PNG, PDF, PNM, and TIFF.

Allows to create batch scripts to apply different transformations to the image.

GD is an open source code library for the dynamic creation of images by programmers. GD is written in C, and "wrappers" are available for Perl, PHP and other languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve website development.

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

You can use the convert command to generate the new images using some command line options like crop or thumbnail.

There is an extensive documentation and usage samples... this one may be useful in your case Resize Thumbnail to Fit.

share|improve this answer
1  
Was one of my first post and there was quite some room for improvement, now I think it's quite better :) – pconcepcion Jan 11 at 14:03

Imageresize (Free, requires python)
Description:
Shrinks specified images so that the largest dimension is SIZE. Images who's largest dimension is already smaller or equal to SIZE are not touched (unless -f is given.) Images may be any format that is handled by the Python Imaging Library (PIL).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .