[<--] [Cover] [Table of Contents] [Concept Index] [Program Index] [-->]
Google
 
Web dsl.org


Viewing Images

As with text, there are tools for both viewing and editing images. This chapter describes the various methods for viewing images; the editing of images is discussed in the next chapter). While you can view an image with an image editor, it is safer (and faster!) to view with a viewer when you do not intend to edit it.

Previewing Print Files

The DVI ("DeVice Independent"), PostScript, and PDF ("Portable Document Format") file formats can be generated by a number of applications. They are graphical image formats commonly used for printing; methods for previewing these files on the display screen are discussed in the following sections.

Previewing a DVI File

Use the xdvi tool to preview a DVI file in X. Give the name of the file to preview as an argument. xdvi will show how the document will look when printed, and let you view it at different magnifications.

To magnify the view of the document, left-click any of the buttons labelled with a percentage, such as 17%; they magnify the view by that percentage.

The following table lists some of xdvi's commands.
COMMAND DESCRIPTION
[Q] Exit xdvi and stop previewing the file.
[N] Advance to the next page.
[P] Move to previous page.
C-c Same as [Q].
C-d Same as [Q].
[SPC] Same as [N].
C-l Redisplay the current page.
[R] Re-read the DVI file.

Previewing a PostScript File

Debian: `ghostview'
Debian: `gv'
WWW: http://wwwthep.physik.uni-mainz.de/~plass/gv/


To preview a PostScript or EPS image file in X, use ghostview. It takes a file name as an argument, and it previews the contents of the file in a window, starting with its first page.

Press [Q] to exit and press [SPC] to advance to the next page, if there is one.

NOTE: Some people prefer the gv tool as an alternate to ghostview; gv is used in much the same way, though it has a different interface.

Previewing a PDF File

Debian: `xpdf'
WWW: http://www.foolabs.com/xpdf/
Debian: `gv'
WWW: http://wwwthep.physik.uni-mainz.de/~plass/gv/


Use xpdf to preview a PDF file. Give the name of the PDF file to preview as an argument.

To exit xpdf, press [Q]; use the two magnifying-glass buttons to zoom the view closer in (+) or further out (-), and use the left and right arrow buttons to move to the previous and next pages, if any.

NOTE: You can also use gv to preview PDF files.

Viewing an Image in X

Debian: `imagemagick'
WWW: ftp://ftp.wizards.dupont.com/pub/ImageMagick/


To view an image in X, use display, part of the ImageMagick suite of tools. It can recognize many image formats, including FlashPix, GIF/GIF87, Group 3 faxes, JPEG, PBM/PNM/PPM, PhotoCD, TGA, TIFF, TransFig, and XBM.

display takes as an argument the file name of the image to be viewed, and it displays the image in a new window.

This command displays the image file in a new window:

viewing-images-display-01

The mouse buttons have special meaning in display. Left-click on the image window to open the display command menu in a new window. The display command menu looks like this:

viewing-images-display-02

Menu items let you change the image size and otherwise change or transform the image display. Choose Overview from the Help menu for an explanation of the various available display commands.

Middle-click on the image to open a new window with a magnified view of the image centered where you click. For example, middle-clicking on the sailboat image in the previous example will open a new window that looks like this:

viewing-images-display-03

Finally, right-click on the image window for a pop-up menu containing a few of the most frequently-used commands; to choose one of these commands, drag the mouse pointer over the command. Commands in the pop-up menu include Quit, which exits display, and the Image Info, which displays information about the image file itself, including number of colors, image depth, and resolution.

The following table describes some of the keyboard commands that work when displaying an image in display.
COMMAND DESCRIPTION
[SPC] Display the next image specified on the command line.
[BKSP] Display the previous image specified on the command line.
C-q Quit displaying the image and exit display.
C-s Write the image to a file.
< Halve the image size.
> Double the image size.
- Return the image to its original size.
/ Rotate image 90 degrees clockwise.
\ Rotate image 90 degrees counter-clockwise.
? Open a new window with information about the image, including resolution, color depth, format, and comments, if any.
h Toggle a horizontal mirror image.
v Toggle a vertical mirror image.
NOTE: display can also be used to view images on the World Wide Web -- see Viewing an Image from the Web.

Browsing Image Collections in X

The display tool offers a feature for browsing a collection of images -- give `vid:' as the file argument, followed by the file names or pattern to match them in quotes. display makes thumbnails of the specified images, and displays them in a new window, which it calls a visual image directory.

In the preceding example, only those files with image formats supported by display are read and displayed.

NOTE: To open an image at its normal size, right-click the image and choose Load; the thumbnail will be replaced by its full-size image. To return to the thumbnail directory, right-click the image and choose Former.

Putting an Image in the Root Window

One way to put an image in the root window (the background behind all other windows) is to use display and give `root' as an argument to the `-window' option.

Browsing Images in a Console

Use zgv to view images in a virtual console (not in X). You can use zgv to browse through the filesystem and select images to view, or give as arguments the names of image files to view. It recognizes many image formats, including GIF, JPEG, PNG, PBM/PNM/PPM, TGA and PCX; one of its nicest features is that it can fill the entire screen with an image.

When you run zgv with no options, it displays image icons of any images in the current directory, listing any subdirectories as folder icons. You can also give the name of a directory as an argument in order to browse the images in that directory.

Use the arrow keys to navigate through the file display; the red border around a image or directory icon indicates which image or subdirectory is selected. Type [RET] to view the selected image or to change to the selected directory.

You can manipulate the images you view in a number of ways -- zoom the image magnification in and out, change the brightness and color, and even make automatic "slide shows" of images. The following table describes some of zgv's options.
OPTION DESCRIPTION
-c Toggle image centering. Images are centered on screen by default; specifying this option turns off centering.
-i Ignore errors due to corrupted files, and display whatever portion of the file is displayable.
-l Start zgv in slide-show mode, where it loops through all images specified as arguments, continuously, until you interrupt it.
-M Toggle mouse support. Mouse support is off by default; this option turns it on.
-r integer Reread and redisplay every image after every integer seconds. Useful for viewing webcam images or other image files that are continuously changing.

Viewing an Image in a Web Browser

If you have a graphical Web browser, such as mozilla, you can use it to view a graphic image. While viewing images in a browser doesn't offer much flexibility (you can't zoom in on a portion of the image, or get information about the image resolution and other details), if you simply want to quickly view an image file while you are in X, and you have a Web browser running, it can be a quick and easy way to do it.

To view an image file in a Web browser, specify a file: URL pointing to the file name of the image in the Location field of the browser.

Notice that the given file: URL only has one preceding slash, pointing to the root directory, and not two, as in http://.

Browsing PhotoCD Archives

Debian: `xpcd'
Debian: `xpcd-gimp'
WWW: http://user.cs.tu-berlin.de/~kraxel/linux/xpcd/


The xpcd tool is an X client for viewing and browsing collections of Kodak PhotoCD images. To browse the images on a Kodak PhotoCD, mount the CD-ROM (see Mounting a CD-ROM), and then give the mount point as an argument to xpcd.

The preceding example will open two new windows -- a small xpcd command bar window, and a larger window containing thumbnails of all PhotoCD images on the disc.

To open a copy of an image in a new window, left-click its thumbnail image. When you do, xpcd will open the image at the second-smallest PhotoCD resolution, 256x384; to view it at a another size, right-click the image and choose the size to view. Once the new window is drawn, you can right-click on this new image to save it as a JPEG, PPM, or TIFF format image.

To view an individual `.pcd' file with xpcd, give the name of the file as an argument.

NOTE: You can also use display to view a `.pcd' PhotoCD image file (see Viewing an Image in X).

See Extracting PhotoCD Images for another recipe for extracting PhotoCD images.

Additional Image Viewers

The following table lists other tools for viewing images.
TOOL DESCRIPTION
animate Part of the ImageMagick suite; use animate to display an animated slide-show sequence of images in X.
Debian: `imagemagick'
WWW: ftp://ftp.wizards.dupont.com/pub/ImageMagick/
xwud Displays files in the special X Window Dump file format, as created by xwd.
Debian: `xbase-clients'
WWW: http://www.xfree86.org/
showpicture Views an image sent as an email attachment; requires xloadimage.
Debian: `metamail'
WWW: ftp://ftp.bellcore.com:/pub/nsb/mm2.7.tar.Z
xli Basic image viewer for X.
Debian: `xli'
xloadimage Nice graphics viewer for X that contains tools for viewing images in the root window.
Debian: `xloadimage'
aview View graphics as "ASCII art." This tool can view any image format supported by the pbmplus utility suite, and has fluid zoom in/out and all the rendering options you'd expect from a world-class viewer.
Debian: `aview'
WWW: ftp://ftp.ta.jcu.cz://pub/aa


[<--] [Cover] [Table of Contents] [Concept Index] [Program Index] [-->]