XLI(1) | General Commands Manual | XLI(1) |
xli - load images into an X11 window or onto the root window
xli [global_options] {[image_options] image ...}
xli [global_options] [image_options] stdin < image
xli displays images in an X11 window or loads them onto the root window. See the IMAGE TYPES section below for supported image types.
If the filename stdin is given, xli will read the image from standard input.
If the destination display cannot support the number of colors in the image, the image will be dithered (monochrome destination) or have its colormap reduced (color destination) as appropriate. This can also be done forcibly with the -halftone, -dither, and -colors options.
A variety of image manipulations can be specified, including gamma correction, brightening, clipping, dithering, depth-reduction, rotation, and zooming. Most of these manipulations have simple implementations; speed was opted for above accuracy.
If you are viewing a large image in a window, the initial window will be at most 90% of the size of the display unless the window manager does not correctly handle window size requests or if you've used the -fullscreen or -fillscreen options. You may move the image around in the window by dragging with the first mouse button. The cursor will indicate which directions you may drag, if any.
When the keyboard focus is in the window you can:
Type 'q' or '^C' to exit xli. Type space, 'n' or 'f' to move to the next image in the list. Type 'b' or 'p' to move to the previous image in the list. Type . to reload the image. Type l to rotate the image anti-clockwise. Type r to rotate the image clockwise. Type 0 to set the images assumed gamma to your display gamma
(usually darkens images) Type 1 to set the images assumed gamma to 1.0
(usually lightens images) Type 5-2 to lighten the image (5 in small steps, up to 2 in large steps) Type 6-9 to darken the image (6 in small steps, up to 9 in large steps) Type > resp. < to zoom in resp. out
A wide variety of common image manipulations can be done by mixing and matching the available options. See the section entitled HINTS FOR GOOD IMAGE DISPLAYS for some ideas.
xli uses the resource class name _XSETROOT_Id for window managers which need this resource set.
The following options affect the global operation of xli. They may be specified anywhere on the command line.
There is an image provided with xli called 'chkgamma.jpg' that lets you set the display gamma reasonably accurately. This file contains two grayscale ramps. The ramps are chosen to look linear to the human eye, one using continuous tones, and the other using dithering. When the display gamma is correct, then the two ramps should look symmetrical, and the point at which they look equally bright should be almost exactly half way from the top to the bottom. (To find this point it helps if you move away a little from the screen, and de-focus your eyes a bit.)
If the equal brightness point is above center increase the gamma, and decrease it if it is below the center. The value will usually be around 2.2 Once you've got it right, you can set the DISPLAY_GAMMA environment variable in your .profile
The following options may precede each image. They take effect from the next image, and continue until overridden or canceled with -newoptions.
The following options may precede each image. These options are local to the image they precede.
To load the rasterfile "my.image" onto the background and replicate it to fill the entire background:
xli -onroot my.image
To load a monochrome image "my.image" onto the background, using red as the foreground color, replicate the image, and overlay "another.image" onto it at coordinate (10,10):
xli -foreground red my.image -at 10,10 another.image
To center the rectangular region from 10 to 110 along the X axis and from 10 to the height of the image along the Y axis:
xli -center -clip 10,10,100,0 my.image
To double the size of an image:
xli -zoom 200 my.image
To halve the size of an image:
xli -zoom 50 my.image
To brighten a dark image:
xli -brighten 150 my.image
To darken a bright image:
xli -brighten 50 my.image
Since images are likely to come from a variety of sources, they may be in a variety of aspect ratios which may not be supported by your display. The -xzoom and -yzoom options can be used to change the aspect ratio of an image before display. If you use these options, it is recommended that you increase the size of one of the dimensions instead of shrinking the other, since shrinking looses detail. For instance, many GIF and G3 FAX images have an X:Y ratio of about 2:1. You can correct this for viewing on a 1:1 display with either -xzoom 50 or -yzoom 200 (reduce X axis to 50% of its size and expand Y axis to 200% of its size, respectively) but the latter should be used so no detail is lost in the conversion.
When zooming color images up you can reduce blockiness with -smooth. For zooms of 300% or more, I recommend two smoothing passes (although this can take awhile to do on slow machines). There will be a noticeable improvement in the image.
You can perform image processing on a small portion of an image by loading the image more than once and using the -merge, -at and -clip options. Load the image, then merge it with a clipped, processed version of itself. To brighten a 100x100 rectangular portion of an image located at (50,50), for instance, you could type:
xli my.image -merge -at 50,50 -clip 50,50,100,100 -brighten 150 my.image
If you're using a display with a small colormap to display colorful images, try using the -gray option to convert to grayscale.
xlito (XLoadImageTrailingOptions) is a separate utility that provides a file format independent way of marking image files with the appropriate options to display correctly. It does this by appending to file a string specified by the user, marked with some magic numbers so that this string can be extracted by a program that knows where to look. Since almost all image files have some sort of image size specifier, the programs that load or manipulate these files do not look beyond the point at which they have read the image, so trailing information can safely be appended to the file. If appending this information causes trouble with other utilities, it can simply be deleted.
xli will recognize these trailing options at the end of the image files, and will treat the embedded string as if it were a sequence of command line IMAGE OPTIONS. Any GLOBAL OPTIONS will be ignored, and the IMAGE OPTIONS are never propagated to other images.
Trailing options can be examined with:
xlito image_file ...
Changed or added with:
xlito -c "string of options" image_file
And deleted with:
xlito -d image_file ...
For example, if you have a gif file fred.gif which is too dark and is the wrong aspect ratio, then it may need to be viewed with:
xli -yzoom 130 -gamma 1.0 fred.gif
to get it to look OK. These options can then be appended to the file by:
xlito -c "-yzoom 130 -gamma 1.0" fred.gif
and from then on xli will get the appropriate options from the image file itself. See the xlito manual entry for more details about this utility.
The file ~/.xlirc (and optionally a system-wide file) defines the path and default extensions that xli will use when looking for images. This file can have two statements: "path=" and "extension=" (the equals signs must follow the word with no spaces between). Everything following the "path=" keyword will be prepended to the supplied image name if the supplied name does not specify an existing file. The paths will be searched in the order they are specified. Everything following the "extension=" keyword will be appended to the supplied image name if the supplied name does not specify an existing file. As with paths, these extensions will be searched in the order they are given. Comments are any portion of a line following a hash-mark (#).
The following is a sample ~/.xlirc file:
# paths to look for images in
path= /usr/local/images
/home/usr1/guest/madd/images
/usr/include/X11/bitmaps
# default extensions for images; .Z is automatic; scanned in order
extension= .csun .msun .sun .face .xbm .bm
Versions of xli prior to version 01, patchlevel 03 would load the system-wide file (if any), followed by the user's file. This behavior made it difficult for the user to configure her environment if she didn't want the default. Newer versions will ignore the system-wide file if a personal configuration file exists.
xli currently supports the following image types:
CMU Window Manager raster files
Faces Project images
Fuzzy Bitmap (.fbm) images
GEM bit images
GIF images (Including GIF89a compatibility)
G3 FAX images
JFIF style jpeg images
McIDAS areafiles
MacPaint images
Windows, OS/2 RLE Image
Monochrome PC Paintbrush (.pcx) images
Photograph on CD Image
Portable Bitmap (.pbm, .pgm, .ppm) images
Sun monochrome rasterfiles
Sun color RGB rasterfiles
Targa (.tga) files
Utah Raster Toolkit (.rle) files
X pixmap (.xpm) files (Version 1, 2C and 3)
X10 bitmap files
X11 bitmap files
X Window Dump (except TrueColor and DirectColor)
Normal, compact, and raw PBM images are supported. Both standard and run-length encoded Sun rasterfiles are supported. Any image whose name ends in .Z is assumed to be a compressed image and will be filtered through "uncompress". If HAVE_GUNZIP is defined in the Makefile.std make file, then any image whose name ends in .gz or .Z will be filtered through gunzip.
Any file that looks like a uuencoded file will be decoded automatically.
The original Author is:
Jim Frost Saber Software jimf@saber.com
Version 1.16 of xli is derived from xloadimage 3.01 has been brought to you by:
Graeme Gill graeme@labtam.oz.au
Version 1.17 of xli is derived from xli 1.16 by
smar@reptiles.org
For a more-or-less complete list of other contributors (there are a lot of them), please see the README file enclosed with the distribution.
xli - the image loader and viewer xlito - the trailing options utility /usr/lib/X11/Xli - default system-wide configuration file ~/.xlirc - user's personal configuration file
Copyright (c) 1989, 1990, 1991, 1992, 1993 Jim Frost, Graeme Gill and others.
Xli is copyrighted material with a very loose license allowing unlimited modification and distribution if the copyright notices are left intact. Various portions are copyrighted by various people, but all use a modification of the MIT copyright notice. Please check the source for complete copyright information. The intent is to keep the source free, not to stifle its distribution, so please write to me if you have any questions.
Zooming dithered images, especially downwards, is UGLY.
Images can come in a variety of aspect ratios. Xli cannot detect what aspect ratio the particular image being loaded has, nor the aspect ratio of the destination display, so images with differing aspect ratios from the destination display will appear distorted. The solution to this is to use xlito to append the appropriate options to the image file. See HINTS FOR GOOD IMAGE DISPLAYS and XLITO for more information.
The GIF format allows more than one image to be stored in a single GIF file, but xli will only display the first.
One of the pseudonyms for xli, xview, is the same name as Sun uses for their SunView-under-X package. This will be confusing if you're one of those poor souls who has to use Sun's XView.
Some window managers do not correctly handle window size requests. In particular, many versions of the twm window manager use the MaxSize hint instead of the PSize hint, causing images which are larger than the screen to display in a window larger than the screen, something which is normally avoided. Some versions of twm also ignore the MaxSize argument's real function, to limit the maximum size of the window, and allow the window to be resized larger than the image. If this happens, xli merely places the image in the upper-left corner of the window and uses the zero-value'ed pixel for any space which is not covered by the image. This behavior is less-than-graceful but so are window managers which are cruel enough to ignore such details.
The order in which operations are performed on an image is independent of the order in which they were specified on the command line. Wherever possible I tried to order operations in such a way as to look the best possible (zooming before dithering, for instance) or to increase speed (zooming downward before compressing, for instance).
Display Gamma should setable in the ~/.xlirc file.
Embedded trailing options override the command line Image Options. Command line options should really override trailing options.
28 Oct 2002 |