XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) NAME xloadimage, xsetbg, xview - load images into an X11 window or onto the root window SYNOPSIS _x_l_o_a_d_i_m_a_g_e [global_options] {[image_options] image ...} _x_l_o_a_d_i_m_a_g_e [global_options] [image_options] stdin < image DESCRIPTION _X_l_o_a_d_i_m_a_g_e displays images in an X11 window, loads them onto the root window, or writes them into a file. Many image types are recognized; use the -_s_u_p_p_o_r_t_e_d option to list them. If the filename _s_t_d_i_n is given, xloadimage will read the image from standard input if this capability is supported by the loader for that image type (most types do support read- ing from stdin). 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 destina- tion) as appropriate. This can also be done forcibly with the -_h_a_l_f_t_o_n_e, -_d_i_t_h_e_r, and -_c_o_l_o_r_s options. A variety of image manipulations can be specified, including gamma correction, brightening, clipping, dithering, depth- reduction, rotation, and zooming. Most of these manipula- tions 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 -_f_u_l_l_s_c_r_e_e_n option. You may move the image around in the window by dragging with the first mouse button. The cursor will indicate which direc- tions you may drag, if any. You may exit the window by typ- ing 'q' or '^C' when the keyboard focus is on the window. If more than one image file is specified on the command line, each image will be shown in order (except if -_m_e_r_g_e or -_g_o_t_o are being used). A wide variety of common image manipulations can be done by mixing and matching the available options. See the section entitled _H_I_N_T_S _F_O_R _G_O_O_D _I_M_A_G_E _D_I_S_P_L_A_Y_S for some ideas. The -_d_u_m_p option causes an image to be written to a file rather than displayed after processing. This allows you to read an image, perform a number of processing operations on it, and save the resultant image. This also allows Sun Release 4.1 Last change: 8 May 1991 1 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) translation from any of the recognized image types into any of the formats that support dumping. _X_s_e_t_b_g is equivalent to _x_l_o_a_d_i_m_a_g_e -_o_n_r_o_o_t -_q_u_i_e_t and _x_v_i_e_w is equivalent to _x_l_o_a_d_i_m_a_g_e -_v_i_e_w -_v_e_r_b_o_s_e. RESOURCE CLASS _X_l_o_a_d_i_m_a_g_e uses the resource class name _X_l_o_a_d_i_m_a_g_e for win- dow managers which need this resource set. This name changed in version 2.00 and 2.01; some previous versions used the name _X_L_o_a_d_I_m_a_g_e (which was difficult to predict) or _x_l_o_a_d_i_m_a_g_e (which conflicted with class naming conventions). GLOBAL OPTIONS The following options affect the global operation of _x_l_o_a_d_i_m_a_g_e. They may be specified anywhere on the command line. Additionally the -_g_l_o_b_a_l option can be used to force an image option to apply to all images. -border _c_o_l_o_r This sets the background portion of the window which is not covered by any images to be _c_o_l_o_r. -configuration Displays the image path, image suffixes, and sup- ported filters which will be used when looking for and reading images. These are loaded from ~/.xloadimagerc and optionally from a systemwide file (normally /usr/lib/xloadimagerc). This replaces the -path option. -default Use the default root weave as the image. This option forces -_o_n_r_o_o_t. If -_d_e_f_a_u_l_t is used alone, it is the same as _x_s_e_t_r_o_o_t with no arguments. If used in conjunction with -_t_i_l_e this option can be used to place images on the default root weave (see EXAMPLES below). -debug Talk to the X server in synchronous mode. This is useful for debugging. If an X error is seen while in this mode, a core will be dumped. -delay _s_e_c_s Automatically advance to the next image after _s_e_c_s seconds. -display _d_i_s_p_l_a_y__n_a_m_e X11 display name to send the image(s) to. -dump _i_m_a_g_e__t_y_p_e[,_o_p_t_i_o_n[=_v_a_l_u_e]] _d_u_m_p__f_i_l_e Rather than displaying the loaded and processed Sun Release 4.1 Last change: 8 May 1991 2 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) image, dump it into an image file of the specified type. For a list of image types that can be dumped, use the -_s_u_p_p_o_r_t_e_d option. Some image types have options that affect the format of the file that's created. See DUMP OPTIONS below. An image can be dumped in any supported dump format regardless of the original image type, so image file type transla- tion is possible using this option. -fit Force image to use the default visual and colormap. This is useful if you do not want technicolor effects when the colormap focus is inside the image window, but it may reduce the quality of the displayed image. This is on by default if -onroot or -windowid is specified. -fork Fork xloadimage. This causes xloadimage to disasso- ciate itself from the shell. This option automati- cally turns on -quiet. -fullscreen Use the entire screen to display images. If com- bined with -onroot, the image will be zoomed to fill the entire rootwindow. -geometry _W_x_H[{+-_X}{+-}_Y] This sets the size of the window onto which the images are loaded to a different value than the size of the image. When viewing an image in a window, this can be used to reduce the size of the destina- tion window. When loading an image onto the root window, this option controls the size of the pixmap which will be loaded onto the root. If the size is smaller than that of the display, the image will be replicated. -goto image_name Forces the next image to be displayed to be the image named _i_m_a_g_e__n_a_m_e. This is useful for generat- ing looped slideshows. If more than one image of the same name as the target exists on the argument list, the first in the argument list is used. -help [option ...] Give information on an option or list of options. If no option is given, a simple interactive help facility is invoked. -identify Identify the supplied images rather than display them. Sun Release 4.1 Last change: 8 May 1991 3 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) -install Forcibly install the image's colormap when the win- dow is focused. This violates ICCCM standards and only exists to allow operation with naive window managers. Use this option only if your window manager does not install colormaps properly. -list List the images which are along the image path. -onroot Load image(s) onto the root window instead of view- ing in a window. This option automatically sets the -fit option. This is the opposite of -_v_i_e_w. _X_S_e_t_b_g has this option set by default. -path Displays miscellaneous information about the program configuration. This option is obsolete and has been replaced by -configuration. -pixmap Force the use of a pixmap as backing-store. This is provided for servers where backing-store is broken (such as some versions of the AIXWindows server). It may improve scrolling performance on servers which provide backing-store. -private Force the use of a private colormap. Normally colors are allocated shared unless there are not enough colors available. -quiet Forces _x_l_o_a_d_i_m_a_g_e and _x_v_i_e_w to be quiet. This is the default for _x_s_e_t_b_g, but the others like to whis- tle. -supported List the supported image types. -type _t_y_p_e__n_a_m_e Forces _x_l_o_a_d_i_m_a_g_e to try to load the image as a par- ticular file type rather than trying to guess. This often improves load performance noticably. -verbose Causes _x_l_o_a_d_i_m_a_g_e to be talkative, telling you what kind of image it's playing with and any special pro- cessing that it has to do. This is the default for _x_v_i_e_w and _x_l_o_a_d_i_m_a_g_e. -version Print the version number and patchlevel of this ver- sion of _x_l_o_a_d_i_m_a_g_e. -view View image(s) in a window. This is the opposite of Sun Release 4.1 Last change: 8 May 1991 4 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) -_o_n_r_o_o_t and the default for _x_v_i_e_w and _x_l_o_a_d_i_m_a_g_e. -visual _v_i_s_u_a_l__n_a_m_e Force the use of a specific visual type to display an image. Normally _x_l_o_a_d_i_m_a_g_e tries to pick the best available image for a particular image type. The available visual types are: DirectColor, TrueColor, PseudoColor, StaticColor, GrayScale, and StaticGray. Nonconflicting names may be abbreviated and case is ignored. -windowid _h_e_x__w_i_n_d_o_w__i_d Sets the background pixmap of a particular window ID. The argument must be in hexadecimal and must be preceeded by "0x" (_e_g -windowid 0x40000b. This is intended for setting the background pixmap of some servers which use untagged virtual roots (_e_g HP- VUE), but can have other interesting applications. IMAGE OPTIONS The following options may preceed each image. These options are local to the image they preceed. -at _X,_Y Indicates coordinates to load the image at on the base image. If this is an option to the first image, and the -_o_n_r_o_o_t option is specified, the image will be loaded at the given location on the display background. -background _c_o_l_o_r Use _c_o_l_o_r as the background color instead of the default (usually white but this depends on the image type) if you are transferring a monochrome image to a color display. -brighten _p_e_r_c_e_n_t_a_g_e Specify a percentage multiplier for a color image's colormap. A value of more than 100 will brighten an image, one of less than 100 will darken it. -center Center the image on the base image loaded. If this is an option to the first image, and the -_o_n_r_o_o_t option is specified, the image will be centered on the display background. -clip _X,_Y,_W,_H Clip the image before loading it. _X and _Y define the upper-left corner of the clip area, and _W and _H define the extents of the area. A zero value for _W or _H will be interpreted as the remainder of the image. Sun Release 4.1 Last change: 8 May 1991 5 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) -colors _n Specify the maximum number of colors to use in the image. This is a way to forcibly reduce the depth of an image. -dither Dither a color image to monochrome using a Floyd- Steinberg dithering algorithm. This happens by default when viewing color images on a monochrome display. This is slower than -_h_a_l_f_t_o_n_e and affects the image accuracy but usually looks much better. -foreground _c_o_l_o_r Use _c_o_l_o_r as the foreground color instead of black if you are transferring a monochrome image to a color display. This can also be used to invert the fore- ground and background colors of a monochrome image. -gamma _d_i_s_p_l_a_y__g_a_m_m_a Specify the gamma correction for the display. The default value is 1.0, a typical display needs 2.0 to 2.5. -global Force the following option to apply to all images rather than one specific image. Local image options will temporarily override any option specified with -global. -gray Convert an image to grayscale. This is very useful when displaying colorful images on servers with limited color capability. It can also be used to convert a bitmap image into a grayscale image, although the resulting image will be smaller than the original. The optional spelling -_g_r_e_y may also be used. -halftone Force halftone dithering of a color image when display- ing on a monochrome display. This option is ignored on monochrome images. This dithering algorithm blows an image up by sixteen times; if you don't like this, the -_d_i_t_h_e_r option will not blow the image up but will take longer to process and will be less accurate. -idelay _s_e_c_s Set the delay to be used for this image to _s_e_c_s seconds (see -_d_e_l_a_y). If -_d_e_l_a_y was specified, this overrides it. If it was not specified, this sets the automatic advance delay for this image while others will wait for the user to advance them. Sun Release 4.1 Last change: 8 May 1991 6 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) -invert Inverts a monochrome image. This is shorthand for -_f_o_r_e_g_r_o_u_n_d _w_h_i_t_e -_b_a_c_k_g_r_o_u_n_d _b_l_a_c_k. -merge Merge this image onto the base image after local pro- cessing. The base image is considered to be the first image specified or the last image that was not pre- ceeded by -_m_e_r_g_e. If used in conjunction with -_a_t and -_c_l_i_p, very complex images can be built up. This option is on by default for all images if the -_o_n_r_o_o_t or -_w_i_n_d_o_w_i_d options are specified. -name _i_m_a_g_e__n_a_m_e Force the next argument to be treated as an image name. This is useful if the name of the image is -_d_i_t_h_e_r, for instance. -newoptions Reset globally-specified options. -normalize Normalize a color image. -rotate _d_e_g_r_e_e_s Rotate the image by _d_e_g_r_e_e_s clockwise. The number must be a multiple of 90. -shrink Shrink an image down to fit on the display. This is particularly useful with servers that do not support window sizes larger than the physical screen (eg DECWINDOWS servers). -smooth Smooth a color image. This reduces blockiness after zooming an image up. If used on a monochrome image, nothing happens. This option can take awhile to per- form, especially on large images. You may specify more than one -_s_m_o_o_t_h option per image, causing multiple iterations of the smoothing algorithm. -tile Tile this image (after any necessary merging or tiling) to create a fullscreen image. This is usually used to create a large background image on which to merge other images. -_g_e_o_m_e_t_r_y can be used to set the new image size to something other than -fullscreen. -title _t_i_t_l_e Change the title of the image. This sets the title bar title if displaying in a window or the NIFF file image Sun Release 4.1 Last change: 8 May 1991 7 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) title if dumping the image. -xzoom _p_e_r_c_e_n_t_a_g_e Zoom the X axis of an image by _p_e_r_c_e_n_t_a_g_e. A number greater than 100 will expand the image, one smaller will compress it. A zero value will be ignored. This option, and the related -_y_z_o_o_m are useful for correct- ing the aspect ratio of images to be displayed. -yzoom _p_e_r_c_e_n_t_a_g_e Zoom the Y axis of an image by _p_e_r_c_e_n_t_a_g_e. See -_x_z_o_o_m for more information. -zoom _p_e_r_c_e_n_t_a_g_e Zoom both the X and Y axes by _p_e_r_c_e_n_t_a_g_e. See -_x_z_o_o_m for more information. Technically the percentage actu- ally zoomed is the square of the number supplied since the zoom is to both axes, but I opted for consistency instead of accuracy. EXAMPLES To load the rasterfile "my.image" onto the background and replicate it to fill the entire background: xloadimage -onroot my.image To center an image on the default root background: xloadimage -default -tile my.image If using a monochrome display and a color image you will probably want to dither the image for a cleaner (and faster) display: xloadimage -default -tile -dither 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): xloadimage -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: xloadimage -center -clip 10,10,100,0 my.image To double the size of an image: xloadimage -zoom 200 my.image Sun Release 4.1 Last change: 8 May 1991 8 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) To halve the size of an image: xloadimage -zoom 50 my.image To brighten a dark image: xloadimage -brighten 150 my.image To darken a bright image: xloadimage -brighten 50 my.image HINTS FOR GOOD IMAGE DISPLAYS 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 -_x_z_o_o_m and -_y_z_o_o_m 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 -_x_z_o_o_m _5_0 or -_y_z_o_o_m _2_0_0 (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 -_s_m_o_o_t_h. For zooms of 300% or more, I recommend two smooth- ing passes (although this can take awhile to do on slow machines). There will be a noticable 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 -_m_e_r_g_e, -_a_t and -_c_l_i_p 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: xloadimage 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 -_g_r_a_y option to convert to grayscale. PATHS AND EXTENSIONS The file ~/.xloadimagerc (and optionally a system-wide file) defines a number of configuration options that affect xloadimage. Sun Release 4.1 Last change: 8 May 1991 9 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) This file is split into three section, the _p_a_t_h section, the _e_x_t_e_n_s_i_o_n section, and the _f_i_l_t_e_r section. The sections are identified by typing the section name followed by an equals sign, eg "path =". The _p_a_t_h statement is used to provide a set of search paths to use when looking for an image of a specified name. Separate each path in the list by whitespace (eg one or more spaces, tabs, or newlines). The path is searched in the order it is specified. For example: path = ~/images /usr/local/images ~fred will first look for the image name you specified, then look for the name in ~/images (the tilde is expanded to the value of $HOME), then in /usr/local/images, then in user fred's home directory. This allows easy use of image repositories. The _e_x_t_e_n_s_i_o_n statement is used to provide a set of default extensions to use when looking for an image of a specified name. Separate each extension in the list by whitespace. The extensions are searched in the order in which they are specified. For example: extension = .gif .jpg If you have a file named _m_y_i_m_a_g_e._g_i_f you could specify the name _m_y_i_m_a_g_e and xloadimage would append the ._g_i_f extension automatically. The _f_i_l_t_e_r statement is used to describe filter programs, such as "uncompress", which are to be applied to image files automatically. You specify one filter program and any number of recognized extensions following the _f_i_l_t_e_r key- word. For example: filter = uncompress .Z specifies that the program _u_n_c_o_m_p_r_e_s_s should be used as a filter whenever an image file has a .Z extension. By default filters are provided for compressed (.Z) files and GNU zip (.gz) files. See the FILTERS section for more information on defining your own filters. Any text on a line following a hash-mark (#) is ignored; if you wish to use a hash-mark in a path, extension, or filter you can escape it using a backslash (\). If you wish to include white-space in a filter program name, path, or extension you can enclose the entire text in double-quotes. For example: Sun Release 4.1 Last change: 8 May 1991 10 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) filter = "gzip -cd" .gz Use backslash (\) characters to allow inclusion of double- quote marks or newlines. The following is a sample ~/.xloadimagerc file: # paths to look for images in path = /usr/local/images # system image repository ~/images # personal images /usr/include/X11/bitmaps # standard X bitmaps # default extensions for images extension = .csun .msun .sun .face .xbm .bm # invoke GNU zip if a .z or .zip extension is found filter = "gzip -cd" .z .zip IMAGE TYPES _X_l_o_a_d_i_m_a_g_e currently supports many common and some uncommon image types, and can create images in several formats. For a complete list use the -_s_u_p_p_o_r_t_e_d option. DUMPING IMAGES Several image dumpers are included that can be used to create a new image after loading and processing. The NIFF (Native Image File Format) is the simplest and creates images that _x_l_o_a_d_i_m_a_g_e can read the fastest; it is essen- tially a copy of the internal image format. Some image dumpers allow options that affect the image out- put. These options are appended to the image type following a comma and are separated by commas. If a value is desired it can be specified following an equals-sign. For example, to create a monochrome JPEG image file with a quality factor of 80, you would use the following command line: xloadimage image_name -dump jpeg,quality=80,grayscale new_image.jpg Option names can be abbreviated but if the abbreviation is too short to be unique the option which will be used is indeterminate. FILTERS Xloadimage supports automatic filtering by recognizing file extensions. By default "compress" and "gzip" files are recognized and their names passed to appropriate commands to decompress them. The xloadimage distribution includes a special "smart" uudecoder, called _u_u_f_i_l_t_e_r that can be used to automatically Sun Release 4.1 Last change: 8 May 1991 11 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) uudecode files for processing. _U_u_f_i_l_t_e_r ignores extraneous lines in the file so it is particularly useful if the uuen- coded file was created by concatenating email or news post- ings that had headers or line-break indicators included. To make use of _u_u_f_i_l_t_e_r you can add the following to your filter = "uufilter -s" .uu .uue The filter will be automatically invoked on any file with a .uu or For a list of filters automatically recognized by xloadimage use the -_c_o_n_f_i_g_u_r_a_t_i_o_n option. SUPPORTED IMAGE OPTIONS The JPEG image dumper supports the following options: arithmetic Use arithmetic encoding. grayscale Force a monochrome (grayscale) image to be created given a color image. nointerleave Create a non-interleaved file. optimize Enable entropy parameter optimization. quality Adjust the quality of the image to be created. The default quality factor is 75; lower values create poorer images. restart _i_n_t_e_r_v_a_l Set the restart interval in MCU rows, or MCUs if 'b' follows the interval value. smooth _s_m_o_o_t_h_i_n_g__f_a_c_t_o_r Set the smoothing factor. Value should be between 0 and 100, inclusive. If you are not familiar with the meaning of these options you can ask the Independent JPEG Group (IJG) via email at jpeg@cs.columbia.edu. The PBM image dumper supports the following options: normal Dump a normal (ascii) PBM/PPM file. raw Dump a RawBits format PBM/PPM file. This is the default and results in significantly smaller image Sun Release 4.1 Last change: 8 May 1991 12 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) files than when using _n_o_r_m_a_l. There is no way to dump a PGM format file or a "compact" PBM format file (sorry). The TIFF image dumper supports the following options: compression Image data compression technique. Can be one of: _n_o_n_e (no compression), _r_l_e (CCITT RLE compression), _g_3_f_a_x (CCITT Group 3 FAX compression), _g_4_f_a_x (CCITT Group 4 FAX compression), _l_z_w (Limpel-Ziv-Welsh compression, the default), _j_p_e_g (JPEG compression), _n_e_x_t (NeXT run-length compression), _r_l_e_w (CCITT RLEW compression), _m_a_c (Macintosh PackBits compression), _p_a_c_k_b_i_t_s (same as _m_a_c), _t_h_u_n_d_e_r_s_c_a_n (ThunderScan compression). _X_l_o_a_d_i_m_a_g_e will save using the MINISBLACK, MINISWHITE, COLORMAP, or RGB photometrics as appropriate for its inter- nal image format. There is no way to specify a particular photometric or any other TIFF fields. AUTHOR Jim Frost CenterLine Software jimf@centerline.com For a more-or-less complete list of other contributors (there are a _l_o_t of them), please see the README file enclosed with the distribution. FILES xloadimage - the image loader and viewer xsetbg - pseudonym which quietly sets the background xview - pseudonym which views in a window /usr/lib/X11/Xloadimage - default system-wide configuration file ~/.xloadimagerc - user's personal configuration file COPYRIGHT Copyright (c) 1989, 1993 Jim Frost and others. _X_l_o_a_d_i_m_a_g_e is copywritten material with a very loose copy- right allowing unlimited modification and distribution if the copyright notices are left intact. Various portions are copywritten by various people, but all use a modification of the MIT copyright notice. Please check the source for com- plete 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. Sun Release 4.1 Last change: 8 May 1991 13 XLOADIMAGE(1) USER COMMANDS XLOADIMAGE(1) BUGS Zooming dithered images, especially downwards, is UGLY. Images can come in a variety of aspect ratios. _X_l_o_a_d_i_m_a_g_e 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. See _H_I_N_T_S _F_O_R _G_O_O_D _I_M_A_G_E _D_I_S_P_L_A_Y_S for more information. The GIF format allows more than one image to be stored in a single GIF file, but _x_l_o_a_d_i_m_a_g_e will only display the first. Only GIF87a format is supported. One of the pseudonyms for _x_l_o_a_d_i_m_a_g_e, _x_v_i_e_w, 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 nor- mally 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, _x_l_o_a_d_i_m_a_g_e 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 win- dow managers which are cruel enough to ignore such details. Sun Release 4.1 Last change: 8 May 1991 14