Image Editing for Power Users on the Mac
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 Terminal.app. Remember, to explore any command in detail, you can either type “man
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`
do
convert $image -resize 200x200 size200-$image
done
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.


Comments
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).
I use it as a sidekick app (to Photoshop) whenever I need to do small, simple adjustments that doesn’t require Photoshop’s raw editing power. It’s fast and it’s good for a lot of smaller image editing tasks. A ‘save for web’ feature as well as more typographic options would greatly enhance it’s usefulness for bloggers/hobby web designers and other web monkeys with limited pixel pushing needs. used iphone
It is great to have the opportunity to read a good quality article with useful information on topics that plenty are interested on.I concur with your conclusions and will eagerly look forward to your future updates. how to prevent hair loss
Would you please contact me about your environment and test results. undershirts for men
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. website design hong kong
I’m not sure exactly why but this web site is loading very slow for me. Is anyone else having this issue or is it a issue on my end? I’ll check back later on and see if the problem still exists.
jogos de meninas | guitar hero online
The volunteer developers of The GIMP have been working hard to develop a polished, user-friendly, and freely distributed image editor. Although the separated palette windows may disturb those users who are used to more traditional layouts, your comfort level should grow exponentially as you discover how pain-free the program is. how to make money
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
Kinda burned out on portal 2 and mortal kombat, and with psn being down I’m craving a bit of on line play, and do you know what, the videos of this beta look pretty fucking awesome!juegos de bob esponja
Apple iPhoto ‘09 is a solid photo editing app for hobbyists and casual users, though professional users may desire more power from the app. buy clomid
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
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
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
We just couldnt leave your website before saying that we really enjoyed the useful information you offer to your visitors? Will be back soon to check up on new posts nottingham student letting agent
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