Tip Details Add a Related Tip

Rate as: Positive Negative

Resizing images to fit in a bounding box with ImageMagick

A common problem on the web is the need to resize images such that they fit within a bounding box. If someone gives you an image that fits inside the box, the image is left as is, if the image goes outside the box (in either or both directions) the image is scaled so that either the height or width matches the box limit, and the other dimension is within the box.

Turns out this is really easy to do with the ImageMagick mogrify command, you can use a command like the following (which is using a bounding box 600 pixels wide, and 500 pixels high):

mogrify -geometry '600x500>' imageName.jpg

This will resize imageName.jpg as needed. Even better, you can operate on an entire directory of images in this same manner:

mogrify -geometry '600x500>' *.jpg
Rating: 100% positive, 2 total Votes
Categories: imagemagick graphics
Added: on May 27, 2007 at 7:24 am
Added By: an anonymous user

Comments on this Tip

Add a Comment
There are no comments for this tip
Your Comment:
(how to format)
Rate This Tip:

Verify Humanity:
Sorry, we know it's annoying, but please enter the characters shown in the image to the left so that we know you're an actual person and not an evil spammer. Thanks.
       

Related Tips

Image Resizing

Categories: imagemagick graphics
100% positive, 1 comment - last added on Apr 21, 2008 at 12:01 pm
– Tip added by an anonymous user on Apr 20, 2008 at 2:27 pm

Wateringmarking images in Imagemagick

100% positive, 0 comments
– Tip added by an anonymous user on May 26, 2007 at 7:14 am

batch resize images using mogrify (imagemagick)

100% positive, 1 comment - last added on May 11, 2008 at 6:51 pm
– Tip added by an anonymous user on Mar 08, 2007 at 5:12 pm

Creating thumbnails in Imagemagick

100% positive, 0 comments
– Tip added by an anonymous user on Jun 14, 2007 at 12:56 pm

Designer desktops for the Mac

Categories: Mac desktop graphics
66% positive, 4 comments - last added on Oct 06, 2007 at 3:10 pm
– Tip added by Marcos84 on Aug 09, 2007 at 3:08 pm

Quickly copy a shape in Illustrator

100% positive, 1 comment - last added on Jul 04, 2007 at 5:13 pm
– Tip added by an anonymous user on Jul 04, 2007 at 4:29 pm

Installing PHP GD on a Leopard Mac

100% positive, 0 comments
– Tip added by an anonymous user on Jun 27, 2008 at 1:39 pm

Online graphing package

Categories: web 2.0 graphics free
100% positive, 0 comments
– Tip added by an anonymous user on Feb 28, 2008 at 12:51 pm

Create animated GIFs with no software

100% positive, 0 comments
– Tip added by an anonymous user on Jan 26, 2008 at 6:20 pm

Generating favicons

Categories: web design graphics free
100% positive, 0 comments
– Tip added by an anonymous user on Dec 11, 2007 at 1:54 pm

Generating favions easily

Categories: web design graphics free
100% positive, 0 comments
– Tip added by an anonymous user on Oct 24, 2007 at 9:47 am

Convert graphics, audio, and video files with no software

100% positive, 0 comments
– Tip added by an anonymous user on Sep 01, 2007 at 7:27 am

Free web graphing program

Categories: web google free graphics
no ratings, 0 comments
– Tip added by an anonymous user on Dec 10, 2007 at 7:56 am

Help finding icons

Categories: web design graphics free
no ratings, 0 comments
– Tip added by an anonymous user on Nov 14, 2007 at 7:07 am

Free on-line vector graphics conversion

Categories: graphics vector art free
no ratings, 0 comments
– Tip added by an anonymous user on Nov 11, 2007 at 1:32 pm

Configuring auto save in Corel Photo-Paint

no ratings, 0 comments
– Tip added by an anonymous user on Oct 06, 2007 at 4:07 pm

Quick zooming in Microsoft Paint

Categories: Microsoft graphics paint
no ratings, 0 comments
– Tip added by an anonymous user on Sep 24, 2007 at 12:32 pm

Generate your own LED signs

Categories: graphics free web
no ratings, 0 comments
– Tip added by an anonymous user on Aug 03, 2007 at 7:56 am

Getting rid of Display errors (Image Magick)

Categories: imagemagick errors
no ratings, 0 comments
– Tip added by an anonymous user on Jun 09, 2007 at 6:46 am

Sparkline code resources

Categories: graphics programming web
no ratings, 0 comments
– Tip added by an anonymous user on Jun 05, 2007 at 7:48 pm