Magick with Images
Ever since the first computers with graphical displays, computer editing and transformation of images has been one of the most popular application areas. There should be little surprise that there is a multiplicity of free graphic software available under Linux.
Many of the available packages are targeted towards specific applications: there are many graphics libraries available for programmers which address reading and writing specific file formats. There are also image viewers available which allow interactive editing as well. ImageMagick is different in that it provides a comprehensive set of tools which can be used interactively in the X Window System or command-line driven. These tools are based around a common library, written in C.
For those who want to go beyond the capabilities of the precompiled programs (see the sidebar “Getting ImageMagick”), the library is extensible to allow the addition of different image file formats. The library can also be used from your own programs through its well documented API. In addition, both Perl and Python interfaces are available to allow image manipulation from scripts.
If you want to try out some of the features of the ImageMagick tools, many of them can be used on-line via the Imaging Machine at http://www.vrl.com/Imaging/.
It is impossible for an article such as this to cover every aspect of ImageMagick; therefore, I have written a short description of each of the major programs. A very good set of on-line documentation can be found at the ImageMagick web site—it covers all aspects of using and programming the system.
Figure 1. Display of File Images
The display program loads images from a file and displays them on the screen (see Figure 1). It has a large number of command-line options which make it very flexible. Display is ideal for running from a script for a presentation or demonstration and will show video as well as still images. Images can be manipulated in a variety of ways, either from the command line or interactively. Figure 2 shows a set of images (the original is in the top left hand corner) that illustrate some of the effects available. In each case, the settings used are the default settings for that effect.
Figure 2. Display of Thumbnail Images
The display program is quite similar to John Bradley's xv image viewer. To display an image, you can either select one interactively from the menus (see Figure 3) or at the prompt type the command:
$ display image.gif
In my research I work with many images in a raw format called YUV 4:1:1. This represents an image as a number of bytes. The YUV representation of an image is a combination of the luminance information in the image (a black and white version) called the Y component, and the chrominance information (the extra information required to make the black and white image into a colour image) called the U and V components. The Y component is thus made up of one unsigned byte per pixel in the image. Since the human eye is less sensitive to colour than luminance, the U and V components, each consisting of a number of signed bytes, are included at half the rate of the Y component. This gives a rather primitive form of lossy image compression compared to the more usual RGB representation where three unsigned bytes are used for every pixel in the image. In the examples here I will use a 176 by 144 pixel image. In order to display such an image, the following command can be used:
$ display -size 176x144\ image.yuvIn addition, if your image file has a header which is not among the supported types and you know that the image is in YUV format (this also applies to other raw formats), you can display it if you know the size of the header. For example, the following command:
$ display -size 176x144+16 image.yuvdisplays a raw YUV image, with a 16-byte header.
Import is an X image-capture program. It captures the contents of a target window, which may be specified in a variety of ways and stores it in a file. The captured image can then be viewed and manipulated with the following tools.
Animate, as its title suggests, displays an image sequence, which can be an MPEG file or a multi-image TIFF or MIFF file. The program works out the number of colours required to display the sequence before starting to play it so that the same palette can be used throughout to avoid interactions with colour schemes of the X Window System.
Montage combines several images into a single image. It is useful in preparing figures for papers and magazine articles, for example. There are options to annotate each image with text and to specify the background texture and colour and the border size. Figure 2 was created from the individual images by use of the montage program. The layout of the tiles and the labels were specified on the command line, and all other settings kept their default values.
Convert allows command-line conversion of images to and from many different formats. Its most common use is to convert to, and from, the ImageMagick MIFF format.
Mogrify provides a variety of different transforms which can be applied to images. A command-line interface to the transforms is available in the menus of the display program.
Identify prints all sorts of useful information about images, including a check on the completeness of the image and whether it is corrupt or not. Here is some example output:
$ identify image.gif image.gif 106x80+0+0 PseudoClass 256c 13453b GIF 2s
In this case the image is in GIF format image, 106 by 80 pixels in size, has a PseudoClass colour map with 256 colours, is 13453 bytes in size and took 2 seconds to process. The -verbose option prints a more comprehensive list of information including the colour map.
Combine allows you to combine images in all manner of different ways. It can also be used to create difference images from two input images to see how they differ. There are a variety of ways in which images can be combined in addition to these two.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




1 hour 16 min ago
1 hour 32 min ago
3 hours 23 min ago
9 hours 15 min ago
13 hours 47 min ago
13 hours 48 min ago
15 hours 48 min ago
1 day 33 min ago
1 day 1 hour ago
1 day 2 hours ago