display
will display an image in just about any format
imaginable on a Unix workstation; just type
display IMAGEFILE
and the image will appear in a window.
Another way to view some images is to load them into your Web browser,
but this obviously only works for images in a format that your browser
can display (GIF, or in some cases JPEG).
display
program you can find out information about the image by
selecting the Image Info option from the menu
that appears when you press the right mouse button with the cursor
over the image.
You can also use the ImageMagick identify
program
to find out certain details about an image from the command line, as in:
% identify sample.gif
sample.gif 303x192 PseudoClass 256c 46026b GIF 1s
convert
does this. It can handle
a huge variety of formats. It takes two arguments --- the input file
first, and the output file second. It deduces the format to convert
to by looking at the extension (everything after the ".") in the
second filename. So for example, to convert a PICT file to GIF:
convert image.pict image.gif
Convert takes lots of options to specify how the conversion is
to be done, and it can do a lot of things in addition to just
converting between file formats. Some of these other operations
are described below; see its
man page for
all the details.
display
allows you to
interactively select a region of an image for cropping. To use
this feature, run display
on your image, and
select the Crop option from the right-mouse
menu, and then use the left mouse button to define your
cropping rectangle. When you are happy with the rectangle, hit
the Crop button in the
Commands window. You can then save the
resulting cropped image via the File->Save
menu in the Commands window.
-crop
option to
the ImageMagick convert
program. For example,
to extract a 200 X 100 rectangle whose upper left corner
is at pixel coordinate (300,400) from an image called
image.gif
, use the command:
convert -crop 200x100+300+400 image.gif newimage.gif
convert
program does scaling easily with its -geometry
option.
For example, to scale an image to be exactly 640 X 480 pixels, give
the command
convert -geometry 640x480! image.gif image.gif
Note that this command overwrites the file image.gif
with
the scaled image; if you want to save the scaled image in a new file
rather than overwriting the original one, specify a new name for the
second file on the command line.
The !
after the size specification in the command above
tells convert
to force the resulting image to be exactly
640 X 480. Without the !
, convert will scale the image
as much as possible to fit within the given size without altering its
aspect ratio, so the result may not be exactly 640 X 480.
There are other ways to specify scaling factors and sizes in the
convert
program; see its
man page for
details.
convert
program will interlace an image when
given the -interlacing PLANE
option. For example,
convert -interlacing PLANE image.gif image.gif
will replace the file image.gif
with an interlaced image.
(The word PLANE
specifies the kind of interlacing to do;
convert
can do two different kinds, but for GIF images for
use on the Web it doesn't matter which one you do.)
As usual, ImageMagick's convert
program can add
transparency to images:
convert -transparency white image.gif image.gif
will change all white pixels in
image.gif
to be transparent. You can also specify the
color to be made transparent using hexadecimal RGB values, for example
-transparency #faf7ef
will make all pixels containing color
#faf7ef
transparent. See the COLOR NAMES
section of the X man
page for details on how to specify RGB colors in this way.
You can use ImageMagick's display
program to find out
the RGB color value of a particular pixel in an image; just press
the middle mouse button with the cursor over the desired pixel.
The ImageMagick program display
lets you do a limited
amount of image touchup and painting; use the Image Edit
menu on the Commands window. (Click the left mouse button
in the image to make the Commands window appear if it
is not already visible).
Comments to:
webmaster@geom.umn.edu
Created: May 31 1996 ---
Last modified: Tue Jun 4 15:27:39 1996