CLIIntroImageMagick

From Media Design: Networked & Lens-Based wiki
Jump to navigation Jump to search


A introduction to the command-line using ImageMagick

The objective of this tutorial is to get comfortable using and working with a command-line interface by using ImageMagick to manipulate images. In particular, working with the command-line (and programming in general), involves learning how to work in a series of steps. A single command may not do exactly what you want, but a sequence of different steps, done in a particular order, may do the trick. A fundamental programming skill is getting comfortable with working in steps like this. A sequence of steps, the text of the actual commands, can be saved into a single text file. This is then called a script. Like a cooking recipe, or a theatrical script, a script can be later perform your original sequence of commands.

Use the ImageMagick cookbook to help do the following exercises.

Exercises

Exercise 1

Take a folder of images you have and make thumbnail images. Start by making a backup of the originals (so you're sure you don't lose them!) Try to do this from the commandline as well! Make sure you understand the difference between the convert and mogrify commands.

Turn the thumbnails you created about into an animated GIF. You can look at the result in a program like Firefox.

Exercise 2

Use the "tiling" cut-up method to break a single image into many tiles. Create an animated GIF from the tiles.

Exercise 3

Extract a specific rectangle from an image. Based on the example of drawing a simple shape (like a circle), and using the composite command, how could you extract a circular portion of an image.


Assignment for next week: Image Sequence

Start with a single image -- this is your "input". Make a copy of your file and call it "image0001.png" (or "image0001.jpg") (remember to zero-pad your file names). Use ImageMagick's commands to alter this image in some way, transforming it, extracting some portion, and give the result the name "image0002.png". Continue in this way, each time using images already created (using image0001 and/or image0002 to make image0003, and so on). Finally, use ImageMagick to assemble the sequence of images into an animation. Save all of your commands from the terminal to a single text file, and save it as something like "image.sh".

Conceptually, think about what kind of sequence you want to make. Is there a narrative (does the sequence tell a story?). Can you make a connection between the order of steps you technically have to make, with the narrative of the sequence.

Post your results (both the animation, and the script) to a page on the wiki so we can look at your results in class next week.

Results:


Attachments

  • CLIIntroImageMagick slide.gif
  • CLIIntroImageMagick real2.gif