Created Monday 04 February 2008
The ImageMagick(1) tool suite is a selection of imensly powerful image capture and manipulation programs. These programs include convert which provides support for converting between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample to name a few behaviours. Other components of Image Magic include transcode, import and convert.
The ImageMagick suite is maintainted by ImageMagick Studio LLC at www.imagemagick.org. The programs are installed with Fedora by default, but if for some reason they're not, they can be installed using yum e.g., yum install ImageMagic. The following sections are a brief overview of the programs that form the Image Magick suite. Fore more details on these see the Image Magick documentation, which is typically installed with Image Magick to (e.g.) either in /usr/share/doc/ImageMagick-<ver>
The following list the programs in the Image Magic tool suite.
The remaining sections go into more detail on each of the programs in the toolsuite. This document is intended as a quick overview and is not a replacement nor repetition of the Image Magick man pages and user documentation, which provided more detailed information.
Tip: Use import(1) to capture window or frame content
This program provides image capture and screen aquisition much like the gimp menu option Acquire. The major difference between the gimp Acquire and import(1) is the level of user control that import provides. In simple terms, import captures an image from either the root window or a specific window. The default image format is Postscript, but this can be changed to any number the supported ImageMagick(1) formats, such as PNG, JPEG, GIF and so on.
To capture a specific window it is first necessary to determine the window identifier, which the local X-Client allocates to every window frame that it is currently managing. This is most easily done using xwininfo(1), which is installed as part of the base Fedora gnu toolsuite. The xwininfo(1) output includes the Window ID on the first line and looks something like Window id: 0x39e4c1c.
If the entire screen is to be captured rather than a single window, then clearly a window ID is not required. These two operational modes (window or entire screen) are selected by providing either of the -screen or the -window options. The following example uses import to capture a window with ID 0x39e4c1c using 24 BPP as the depth and PNG as the output image format. The -delay option is only necessary if the window is only partially visible as it allows the window to be brought to the front before the iamge capture starts. If the window is partially obsured, then the resulting image capture will include only that portion which is visible, with the hidden part (rather oddly) replaced with only a portion of the covering window frame, upto the outline of the window frame that is being captured.
Note: Use xwininfo(1) to establish the ID of the window to capture. Also, the -frame option ensures that the window manager frame is included in the result.
bash $ import -frame -depth 24 -identify -window 0x39e4c1c -delay 3000 png:foo.png
The previous command creates a file called foo.png, which without otherwise specifying other attributes is a non-interlaced PNG image data, in 16-bit RGB color. A pipeline execution of xwininfo(1) can be fed into import(1), providing a rather useful image capture scriptlet. The following execution extracts out the window ID from the window chosen by the user from the xwininfo execution and passes this as the argument for import(1)'s -window option. Another advantage passing the xwininfo pipeline result into import is that the -delay is no longer required.
Tip: The window frame to capture must be fully visible, before execution, otherwise the resulting image will not include the hidden portion of the frame.
bash $ import -frame -depth 24 -identify -window `xwininfo |grep 'Window id:' | awk '{print $4}'` png:foo.png
The convert(1) program is used for converting between different image formats. The convert program also performs other image manipulation such as crop and resize. To convert (e.g.,) a JPEG image to PNG, use convert specifying the source image and the destination image format and pathname. E.g.,
bash $ convert foo.png gif:bar.gif
Converts a image file in PNG format to a file called bar.gif, which (without specifying other attributes) is a file containing version 89a GIF image data.
Stuart Moorfoot © Feb 2008 foo@bund.com.au