Image Editing for Power Users on the Mac

by Devanshu Mehta Oct 11, 2007

ImageMagick is an extraordinarily powerful open source package that contains many different utilities to edit and create images. With a single line on the command line, you can rotate, resize, merge, convert, and subtitle a collection of images. You can get started right away—once you’ve installed ImageMagick—with fairly simple commands, such as the first “convert” example below. But once you get comfortable with it, it could even replace your trusty (bloated!) image editor.

To install ImageMagick, you will need either Fink or MacPorts, or follow the “Mac OS X Binary” installation instructions on the ImageMagick web site. To get started with Fink, try my earlier article about using Fink.

Each of these commands needs to be run on the command line in an application like Remember, to explore any command in detail, you can either type “man

” (e.g. man convert) on the command line or visit the extensive ImageMagick online help.

Converting File Formats
With ImageMagick, converting the file format is as simple as giving it a new file name with the “convert” command. The following will convert a JPG file named xyz.jpg into a TIFF named xyz.tiff.

convert xyz.jpg xyz.tiff

Replace “tiff” with “gif,” “png,” or any other popular image format to convert it to that format.

Create Thumbnails in an Instant
Creating thumbnails of images in most image editors requires a few clicks, and editing them in bulk is harder than pulling each hair out of your scalp individually.

With ImageMagick:

convert xyz.jpg -resize 50% xyz50.jpg

That will change the image xyz.jpg to 50% its original size and name the newly created file xyz50.jpg. The “convert” command will always create a new image file, and the last argument supplied to it will be its name.

convert xyz.jpg -resize 50x50 xyz5050.jpg

The command above will change it to a 50x50 thumbnail.

You can combine different ImageMagick options like this:

convert xyz.jpg -resize 50% xyz50.png

Rotate a Set of Images
Rotating an image is just as simple. In the example below, “-rotate 30” means rotated 30 degrees in the clockwise direction.

convert xyz.jpg -rotate 30 xyz30r.jpg

Of course, it is more likely that you will want to rotate your photograph by 90 or 270 degrees, but no one is stopping you from being quirky.

To Add a Subtitle or Text Caption
Sometimes you just want to add a little text to your image. This can be done with most GUI image editing tools, but not quite as simply as with ImageMagick—especially if you want to add the same text to many images. Examples of such a situation would be a watermark with the source of the image, a subtitle with the album name, or a copyright notice.

convert xyz.jpg -draw “text 10,10 ‘Nifty Text!’” xyzNifty.jpg

This command will add the text “Nifty Text!” to the image xyz.jpg at the coordinates (10,10) which are calculated from the top left corner. You can even specify font and point size to make your text more or less pronounced.

convert xyz.jpg -draw “text 10,10 ‘Nifty Text!’” -font Courier -pointsize 35 -stroke white xyzNifty.jpg

Again, if you play around with these tools more, your powers will increase. But remember, with great power…

Create Text Banner
Creating a banner in ImageMagick is also fairly simple. This time you would use the convert command without an actual source file.

convert -size 200x40 xc:transparent -font Courier -pointsize 20 -channel RGBA -gaussian 0x6 -fill darkred -stroke magenta -draw “text 10,30 ‘My Nifty Banner!’” nifty-magick.png

This example will create a new transparent image sized 200x40, and type the magenta text “My Nifty Banner!” at coordinates (10,30). You can see how far you can get with a few options, and the “convert” command has many more.

Create a Montage
ImageMagick also comes with the “montage” command which allows you to create—you guessed it—a montage of all the images you specify. In addition to simply “montaging” them, you can give it a background and border and each image a caption.

montage -background black -border 1 -label %f *.jpg montage.jpg

It is slightly self-explanatory, but the command above will create a montage of every JPG image in the current directory, with a black background and call it montage.jpg. The “-label %f” gives each image a label with its file name and “-border 1” gives it a thin border.

Get Information About an Image
Simply type the following to get some basic information about an image. To get a really large amount of information, including EXIF data (e.g. from your camera):

identify xyz.jpg

To get a lot more detailed information about the image, try the following:

identify -verbose xyz.jpg

Here’s an excerpt of the “identify” data from one of my images:

Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 1600x1200+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 93
  Orientation: TopLeft
  Exif:ColorSpace: 1
  Exif:DateTime: 2007:10:03 22:55:49
  Exif:DateTimeDigitized: 2007:10:03 20:35:52
  Exif:DateTimeOriginal: 2007:10:03 20:35:52
  Exif:ExifImageLength: 1200
  Exif:ExifImageWidth: 1600
  Exif:ExifOffset: 213
  Exif:ExifVersion: 0220
  Exif:FNumber: 14/5
  Exif:Make: Apple
  Exif:Model: iPhone
  Exif:Orientation: 1

There is actually three times as much information as is displayed.

Bulk Actions on Image Files

In many cases, the *.jpg type wildcard will suffice to perform actions on a large number of files. For example,

mogrigy -resize 200x200 *.jpg

This will resize every single JPG image in the directory to a 200x200 size and retain their names. This will overwrite the original image, so be careful. If you want to create a new file, you can use the “convert” command mentioned above. In order to use the “convert” command on a large number of files, we will have to script a bit.

for image in `ls *.jpg`
  convert $image -resize 200x200 size200-$image

This should be easy to read if you have programmed before, but even otherwise, it is fairly English-like. Basically, it will take every JPG file in the current directory, resize it to 200x200, and rename it with the prefix “size200-.” Edit it and test it on some images you can afford to mangle. This is great for creating thumbnails for a web site or smaller sized images to email.



  • att: webmaster

    where is the print command?

    when readers save an article, they need to be able to discard the non-editorial elements (navbars, adverts etc) ... and the print command is often the only effective way to strip out all the flotsom from the saved file that would otherwise pollute the (desktop/enterprise) search space with extraneious keywords.

    btw: please implement the ‘print’ view of the DOM with proper css3/xhtml2 or at least html5 .... NOT with javascript (many people now browse with jscript and actionscript disabled because they are usually buggy & also are a HUGE waste of cpu resources).

    zahadum had this to say on Oct 11, 2007 Posts: 6
  • Photoshop Elements 9 makes sharing your photos simple, especially online via social networks, email, etc. There are templates to create web galleries, scrapbooks, greeting cards, photo collages and more. These can be shared digitally, by mobile phone (MMS), or they can be printed. cialis

    yasir had this to say on Sep 21, 2011 Posts: 11
  • I’m not sure exactly why, but this web site is loading very slow for me. Does anyone else have this problem or is this an issue on my end? I’ll look back later and see if the problem persists lose weight

    yasir had this to say on Sep 25, 2011 Posts: 11
  • That’s just brilliant! there is nothing less difficult and I believe that is the key to its success. I really adore what you had to say. Keep going because you definitely bring a new voice to this subject. It has information I have been searching for a long time. buy facebook fans | buy twitter followers

    Emma Isabella had this to say on Sep 30, 2011 Posts: 1
  • Very informative article you have got here. I love reading this kind of stuff. This is truly a great read for me. I hope to see more articles from you. cialis acheter

    savva4444 had this to say on Oct 05, 2011 Posts: 2
  • The volunteer developers of The GIMP have been working hard to develop a bright and easy to use, and publisher of free distribution of images. Despite the separated palette windows may disturb users who are accustomed to more traditional layouts, your comfort level should grow exponentially as you discover how pain without the program workwear footwear

    yasir had this to say on Oct 09, 2011 Posts: 11
  • Photoshop Elements 9 makes sharing photos easy, especially through online social networks, email, etc. There are templates for creating web galleries, scrapbooks, greeting cards, photo collages and more. These can be shared digitally, via mobile (MMS), or can be printed semenax

    yasir had this to say on Oct 10, 2011 Posts: 11
  • Your Blog is Fabulous. Good article rather. Very interesting.
    Great features.
    I read it. very nice!
    Amazing post.
    its nice and interesting.

    rana waqas had this to say on Oct 13, 2011 Posts: 2
  • ImageMagick is a robust collection of UNIX tools and libraries offered under a usage license to read, write, and manipulate an image in many image formats (over 89 major formats) including popular formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick you can create images dynamically, making it suitable for Web applications. You can also resize, rotate, sharpen, color reduce, or add special effects to an image or image sequence and save your completed work in the same or differing image format. Image processing operations are available from the command line, or from the C, C++, Perl, Java, PHP, Python, or Ruby programming languages. A high-quality 2D renderer is included, which provides a subset of SVG capabilities.
    Créer Blog
    Video viral

    buzz video had this to say on Oct 18, 2011 Posts: 1
  • Such as this web-site your web site is 1 of my new most popular.I similar to this information shown and it has offered me some sort of ideas to possess success for some cause, so keep up the excellent work! sms text messages

    jimee had this to say on Oct 19, 2011 Posts: 3
  • I just rewatched souvenir the other night, and the award is well deserved. : tofranil viagra o vitestable : emea sildenafil viagra lotrisone levitra : propecia kaufen medikamente lilly icos

    GromEbat had this to say on Nov 08, 2011 Posts: 1
  • when readers save an article, they need to be able to discard the non-editorial elements (navbars, adverts etc) ... and the print command is often the only effective way to strip out all the flotsom from the saved file that would otherwise pollute the (desktop/enterprise) search space with extraneious keywords. viagra

    savva4444 had this to say on Nov 08, 2011 Posts: 2
  • Your present web-site is swiftly increasing to be certainly one of my top aspect. So, I just came on resourceful website and I just need to condition that this awesome is a awesome writing. Bless you associated with this type of information. Internet Marketing News

    adnanffc had this to say on Nov 10, 2011 Posts: 1
  • Page 1 of 1 pages
You need log in, or register, in order to comment