search | site map

Scott Granneman

panorama-009.jpg
  • Writing
    • Books
    • SecurityFocus
    • Linux Magazine
    • Others
    • Swings & Misses
  • Presentations
    • Interviews
    • Ladue Chapel
  • Teaching
    • Current Courses
    • Student Evaluations
    • Washington University
    • Webster University
    • St. Louis Community College
    • Archives
  • Web Development
    • Becoming a Web Developer
    • Coding
    • Programming
    • Editors
    • Web Browsers
    • Domains
    • Hosting
    • Graphics & Multimedia
    • Content
  • Tech Info
    • Background
    • Tools
    • Intellectual Property
    • Security
    • Email
    • Networking
    • Blogs, Podcasts, RSS
    • Search
    • Linux
    • Windows
    • Education
  • Personal
    • Work
    • Movies
    • Music
    • Reading
    • Poetry
    • Prose
    • Photos
    • Journals
    • Commonplace Book
    • Our Home
    • Opinions & Editorials
Home > Web Development > Graphics & Multimedia > Multimedia > The Power of ImageMagick

The Power of ImageMagick

ImageMagick is a software package that comes with standard with Red Hat Linux. It is an amazingly powerful piece of software, and although it's not super intuitive, it's worth your time to learn how to use it. Besides, it's pretty easy to start using it to do some useful things.

Let's say you want to get basic info about a directory of images. Just cd to the directory and run identify *. You'll get a list of file dimensions, file formats, and other info for each file.

What if you want to convert a directory full of images from, say, PNG to JPG? In your favorite text editor, type the following:

for i in *
do
 convert $i $i.$2
 rename .$1.$2 .$2 *.$1.$2
done

This creates a for loop that looks at every file in a directory and converts it from file type 1 to file type 2.

After entering the above in your text editor, save the file as "convertimage" in the bin directory found in your home directory (what? you don't have a bin directory in your home directory? Make one!). On my machine, convertimage is in /home/rsgranne/bin.

Now cd to your bin directory and enter the following:

chmod 774 convertimage

You just made convertimage into an executable command. Now cd to the directory with the images you'd like to convert. Let's say they're all PNGs and you want to convert them to GIFs. Just type the following (remember that Linux is case-sensitive):

convertimage png gif

Now type ls to check what you've done. You've still got all your original images with the png extension, but you've also got new images with the gif extension.

These are just two of the cool things that ImageMagick can do for you. This wonderful program also makes it easy for you to automate things like image resizing and on-the-fly image creation. For more info, check out the ImageMagick Web site at http://www.imagemagick.org.

Contact

Email scott@granneman.com
Voice 314-780-0489
Address
39 Summit Place
St. Louis, MO 63119
United States

Work

For work info, see WebSanity.

All content, unless under a Creative Commons license, is © 1997-2011 Scott Granneman.

(Take a look around—a lot of content is licensed under a Creative Commons license, which gives YOU a lot of freedom to reuse my work.)

facebook_32.png Facebook   twitter_32.png Twitter
linkedin_32.png LinkedIn   friendfeed_32.png FriendFeed
flickr_32.png Flickr   lastfm_32.png Last.fm
youtube_32.png YouTube   rss_32.png RSS