[Войти] [Зарегистрироваться]

Наши друзья и партнеры

Беспроводные выключатели nooLite

Lines Club

Ищем достойных соперников.

Книги по Linux (с отзывами читателей)

Библиотека сайта или "Мой Linux Documentation Project"

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18. 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.

18.1 Previewing Print Files  Previewing print-image files.
18.2 Viewing an Image in X  Displaying an image in X.
18.3 Browsing Images in a Console  Displaying an image in the console.
18.4 Viewing an Image in a Web Browser  Viewing images in a Web browser.
18.5 Browsing PhotoCD Archives  Browsing a Kodak PhotoCD.
18.6 Additional Image Viewers  Additional tools for viewing images.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.1 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.

18.1.1 Previewing a DVI File  Previewing DVI files.
18.1.2 Previewing a PostScript File  Previewing PostScript files.
18.1.3 Previewing a PDF File  Previewing PDF files.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.1.1 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 preview the file `gentle.dvi', type:

    $ xdvi gentle.dvi RET

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.

  • To magnify the view by 33%, left-click the button marked 33%.

The following table lists some of xdvi's commands.

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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.1.2 Previewing a PostScript File

@sf{Debian}: `ghostview'
@sf{Debian}: `gv'
@sf{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.

  • To preview the file `/usr/doc/gs/examples/tiger.ps', type:

    $ ghostview /usr/doc/gs/examples/tiger.ps RET

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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.1.3 Previewing a PDF File

@sf{Debian}: `xpdf'
@sf{WWW}: http://www.foolabs.com/xpdf/
@sf{Debian}: `gv'
@sf{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 preview the PDF file `flyer.pdf', type:

    $ xpdf flyer.pdf RET

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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.2 Viewing an Image in X

@sf{Debian}: `imagemagick'
@sf{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.

  • To view the file `sailboat.jpeg', type:

    $ display sailboat.jpeg RET

This command displays the image file in a new window:


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:


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:


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.

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.

18.2.1 Browsing Image Collections in X  Browsing a directory of images in X.
18.2.2 Putting an Image in the Root Window  Putting an image in the root window.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.2.1 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.

  • To browse through the image files with a `.gif' extension in the `/usr/doc/imagemagick/examples' directory, type:
    $ display 'vid:/usr/doc/imagemagick/examples/*.gif' RET

  • To browse through all image files in the current directory, type:

    $ display 'vid:*' RET

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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.2.2 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.

  • To put the image `tetra.jpeg' in the root window, type:

    $ display -window root tetra.jpeg RET

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.3 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.

  • To browse the images in the current directory, type:
    $ zgv RET

  • To browse the images in the `/usr/share/gimp/scripts' directory, type:

    $ zgv /usr/share/gimp/scripts RET

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.

-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.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.4 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.

  • To view the file `/usr/share/images/mondrian-15.jpeg', type:

    file:/usr/share/images/mondrian-15.jpeg RET

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

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.5 Browsing PhotoCD Archives

@sf{Debian}: `xpcd'
@sf{Debian}: `xpcd-gimp'
@sf{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 section Mounting a CD-ROM), and then give the mount point as an argument to xpcd.

  • To browse the images on the PhotoCD disc mounted on `/cdrom', type:

    $ xpcd /cdrom RET

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.

  • To view the PhotoCD file `driveby-001.pcd', type:

    $ xpcd driveby-001.pcd RET

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

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

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.6 Additional Image Viewers

The following table lists other tools for viewing images.

animate Part of the ImageMagick suite; use animate to display an animated slide-show sequence of images in X. {@sf{Debian}}: `imagemagick' {@sf{WWW}}: ftp://ftp.wizards.dupont.com/pub/ImageMagick/
xwud Displays files in the special X Window Dump file format, as created by xwd. {@sf{Debian}}: `xbase-clients' {@sf{WWW}}: http://www.xfree86.org/
showpicture Views an image sent as an email attachment; requires xloadimage. {@sf{Debian}}: `metamail' {@sf{WWW}}: ftp://ftp.bellcore.com:/pub/nsb/mm2.7.tar.Z
xli Basic image viewer for X. {@sf{Debian}}: `xli'
xloadimage Nice graphics viewer for X that contains tools for viewing images in the root window. {@sf{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. {@sf{Debian}}: `aview' {@sf{WWW}}: ftp://ftp.ta.jcu.cz://pub/aa

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

Эта статья еще не оценивалась
Вы сможете оценить статью и оставить комментарий, если войдете или зарегистрируетесь.
Только зарегистрированные пользователи могут оценивать и комментировать статьи.

Комментарии отсутствуют