The Save Window

Damned if it doesn't look suspiciously like the xv load window! The xv save window lets you write images back to disk, presumably after you've modified them. You can write images back in many different formats, not just the original format.

Warning! Images are saved as they are currently shown! (i.e. At the current size, with the current color modification, rotation, cropping, etc. applied.) The only exceptions to this rule are if you are displaying images on a 1-bit B/W display, or displaying 24-bit images on a non-24-bit display. The fact that such images have to be dithered in order to be displayed doesn't count as 'modification', and the file won't be saved 'as displayed'. As such, you can manipulate and save color images on a 1-bit display, and 24-bit images on any type of display, even if you can't really see them 'as they are'.

For the most part, the xv save window operates exactly like the xv load window. (See "The Load Window" for details.) Only the differences are listed here.

When the window is opened, it should have the filename of the currently loaded file already entered into the text entry region. If you click on a file name in the list window, this name will be cleared and replaced with the new name. Likewise, the Format and Colors selections will reflect the currently loaded image. This behavior can be annoying if you are using xv to do file format conversion, or are routinely typing the same filename (a piped command, for instance).

The Prev Set button restores the Format and Colors choices to the settings that were used the last time a file was saved during this particular run of xv.
Likewise, the Prev Name button restores the filename string to the value it had the last time a file was saved.

At the top of the window are a pair of pull-down menus, Format and Colors . These menus let you choose the image file format and color settings that will be used when you save the image. Normally, they display the format that the current image is already in. If you change formats, and your filename has a recognized suffix (i.e., '.gif', '.GIF', '.pbm', etc.), the suffix portion of your filename will be replaced with the new, appropriate suffix for the selected format.

You can pipe output from xv to other programs by using the xv save window. If the first character of the specified filename is '!' or '|', the rest of the filename is interpreted as a command to pipe output to, in the currently selected image format. A fine use for this feature is directly printing images to a PostScript printer by selecting 'PostScript' in the formats list, and typing something like " | lpr " as the filename. In this case, xv will create a temporary file, write the PostScript to that file, and cat the contents of that file to the entered command. xv will wait for the command to complete. If the command completed successfully, the xv save window will disappear. If the command was unsuccessful, the window will remain visible. In any event, the temporary file will be deleted.

Normally, when you save an image, it will be saved at the current expansion (i.e., one screen pixel will map to one image pixel in the saved file). Sometimes, however, it's desirable to save an image at its original size. This is particularly relevant when you're viewing images larger than your screen. By default, xv will automatically shrink images so that they fit on the screen. If you save these images, you'll find that you've lost a lot of data, that maybe you wanted to keep. That's what this checkbox is here for. Note: certain operations, most notably the Smooth and Dither commands, only affect the 'displayed' image. If you choose to save an image at its normal size, these effects will not be in the saved image.
If you have a selection rectangle drawn on the image, this control can be used. When enabled, only the contents of the selection will be saved. This can be very useful if you want to break parts of an image out into their own files, as was done extensively to put together this documentation. (i.e. I Grab 'bed an xv window, such as this save window, moved the selection rectangle around so that it contained various parts of the image (such as the 'Selected Area' button to the left), and saved these parts in their own separate files, for use with Microsoft Word.)

One important note: If your selection goes 'off-screen' (beyond the boundaries of the xv image window), as can happen when you zoom-in to fine-tune the position of the selection rectangle, your selection will be cropped to the window when you save it, unless you also turn on the Normal checkbox. You can not save expanded areas of the image that are not visible in the xv image window, as such areas don't really exist (they aren't computed).

Color Choices

At the top of the xv save window there is the Colors menu, which contains a list of possible color styles to use when saving the image.. Most file formats support different 'sub-formats' for 24-bit color, 8-bit greyscale, 1-bit B/W stippled, etc. Not all of them do. Likewise, not all 'Color' choices are available in all formats.

In general, the choices in the Colors menu do the following:

Saves the image as currently shown with all color modifications, cropping, rotation, flipping, resizing, and smoothing. The image will be saved with all of its colors, even if you weren't able to display them all on your screen. For example, you can load a color image on a 1-bit B/W display, modify it, and write it back. The saved image will still be full color, even though all you could see on your screen was some B/W-dithered nightmare.
Like Full Color , but saves the image in a greyscale format.
Like Full Color , but before saving the image xv generates a 1-bit-per- pixel, black-and-white dithered version of the image, and saves that, instead.
Saves the image as currently shown, with all color modifications, cropping, rotation, flipping, resizing, and smoothing. The image will be saved as shown on the screen, with as many or few colors as xv was able to use on the display. The major purpose of this is to allow special effects (color reduction) to be saved, in conjunction with the '- ncols' command line option. You will probably never need to use this.

Format Notes

While xv can read both the GIF87a and GIF89a variants of the GIF format, it will normally write GIF87a. xv will only write a GIF89a file if there are image comments to be saved (comment blocks being a GIF89a extension).. This is in keeping with the GIF89 specification, which states that if you don't need any of the features added in GIF89, you should continue to write GIF87, for greater compatibility with old GIF87-only readers.

Since GIF only supports one format (up to 8 bits per pixel, with a colormap), there will be no file size difference between a Full Color and a Greyscale image. A B/W Dithered image, on the other hand, will be considerably smaller.

If you are currently in 24-bit mode , and you are saving in any color mode other than B/W Dithered , the currently selected 24->8 conversion algorithm will be used to generate an 8-bit version of the current image, and that image will be written. (See "The 24/8 Bit Menu" for more info.)

One minor clarification: 'JPEG' is an image compression algorithm, not an image file format. 'JFIF' is a file format created by the fine folks at the Independent JPEG Group for the storage and interchange of 'JPEG'-ed image data. As such, it is the de-facto standard for 'JPEG' images. So, technically, when folks talk about 'JPEG' files, what they probably mean is 'JFIF' files, but it's not necessarily so. Therefore, it is possible to run across 'JPEG' files that xv can't read, because they don't adhere to the 'JFIF' file format standard. Just thought you'd like to know.

Full Color images are written in a 24-bit RGB format, and Greyscale images are written in an 8-bit greyscale format. B/W Dithered images should not be used, as they will probably wind up being larger than Greyscale versions of the same images, due to the way JPEG works. Note: You cannot write a Reduced Color JPEG file. Trust me, given the method that JPEG uses to compress, it's not in your best interest to save Reduced Color JPEG files. If you attempt to do so, a Full Color JPEG file will be saved.

When you save in the JPEG format, the dialog box shown above will pop up and ask you for a quality setting and a smoothing value. '75%' is the default quality value, and really, it's a fine choice. You shouldn't have to change it under normal circumstances. The lower you set the quality, the higher the compression ratio will be (i.e., the JPEG file will be smaller). Note that setting the quality setting to '100%' will not result in 'lossless JPEG' (i.e., the original and the JPEG'd images will not be exactly the same, just very close).

The smoothing value is used to 'blur' images before saving them. It's often a good idea to blur GIF (and other 8-bit color) images before saving them, as you'll get better compression that way, and it also may partially undo the dithering that been done to many 8-bit images. On the downside, you'll also get somewhat blurred images. Something you have to decide for yourself.

Note: The JPEG support in xv is optional. While it is normally enabled, it is possible that it may not be enabled on your system (due to problems compiling the JPEG library, or something). If this is the case, you won't have a JPEG selection in the Format menu. Please feel free to complain to whomever built the binary that you're using.

Full Color and Reduced Color images are written in a 24-bit RGB format, and Greyscale images are written in an 8-bit greyscale format. B/W Dithered images are written in a 1-bit B/W format.

When you save in the TIFF format, the dialog box shown above will pop up and ask you which type of image compression it should use. None , LZW , and PackBits compression types are available for use with all the Color modes. In addition, there are two B/W Dithered - only algorithms, CCITT Group3 and CCITT Group4 .

Note: The TIFF support in xv is optional. While it is normally enabled, it is possible that it may not be enabled on your system (due to problems compiling the TIFF library, or something). If this is the case, you won't have a TIFF selection in the Format menu. Please feel free to complain to whomever built the binary that you're using.

Full Color and Reduced Color images are stored in a 24-bit RGB format, Greyscale images are stored in an 8-bit greyscale format, and B/W Dithered images are stored in a 1-bit B/W format.

xv writes Encapsulated PostScript, so you can incorporate xv-generated PostScript into many desktop-publishing programs. xv also prepends some color-to-greyscale code, so even if your printer doesn't support color, you can still print 'color' PostScript images. These images will be three times larger (in file size) than their greyscale counterparts, so it's a good idea to save Greyscale PostScript, unless you know you may be printing the file on a color printer at some point.

Also, you should probably never need to generate B/W Dithered PostScript, as every PostScript printer I've ever heard of can print greyscale images. The only valid cases I can think of are: A) doing it for a special effect, and B) doing it to generate a much smaller (roughly 1/8 th the size) PostScript file.

Note: When you try to save a PostScript file, the xv postscript window will pop up to let you specify how you want the image printed. (See "The PostScript Window" , for details.)

Full Color images are saved in PPM format. Greyscale images are saved in PGM format. B/W Dithered images are saved in PBM format. Each of these formats are tailored to the data that they save, so PPM images are larger than PGM images, which are in turn larger than PBM images.

In the raw variation of the PBM formats, the header information is written in plain ASCII text, and the image data is written as binary data. This is the more popular of the two dialects of PBM, as it produces considerably smaller image files.

Like PBM/PPM (raw) , only the image data is written as ASCII text. As such, images written in this format will be several times larger than images written in PBM/PGM/PPM (raw) . This is a pretty good format for interchange between systems because it is easy to parse. Also, since they are pure, printable ASCII text, images saved in this format can be mailed, without going through a uuencode-like program.

Note that xv-created PBM files (both raw and ascii variants) may break some PBM readers that do not correctly parse comments. If your PBM reader cannot parse comments, you can easily edit the PBM file and remove the comment lines. A comment is everything from a "#" character to the end of the line.

Saves files in the format used by the bitmap program, which is part of the standard X11 distribution. Since bitmap files are inherently 1-bit per pixel, you can only select the B/W Dithered option for this format.
New to xv version 3.10, you can now load and save images in the XPM (X PixMap) format. Such files are best suited to small-ish images with a small number of colors, such as multi-color icons, and the like. One nifty feature of this format is that images can be created and edited using a text editor. All color choices work as expected. One warning: xv will not write out an XPM file with more than 256 different colors. If you are viewing a 24-bit image and save it as an XPM file, xv will first compute an 8-bit version of the image using the current 24->8 conversion algorithm (see "The 24/8 Bit Menu" ), and then save that.
xv will write a number of different types of BMP files depending on the 8/24 bit mode that you're in, the number of colors in the image, and the current 'Colors' choice.

If you are currently in 8-bit Mode , and you select Full Color , Reduced Color, or Greyscale , xv will write out an uncompressed 4- or 8-bits per pixel BMP file, based on the number of different colors in the current image.

If you are in 24-bit Mode and you select Full Color , the program will write out an uncompressed 24-bits per pixel image.

If you are in 24-bit Mode and you select Greyscale , an uncompressed 8-bit per pixel BMP file will be written.

If you select B/W Dither , a 1-bit per pixel BMP file will be written.

Full Color and Reduced Color images are stored in a 24-bit RGB format, Greyscale images are stored in an 8-bit greyscale format, and B/W Dithered images are stored in a 1-bit B/W format.
If you select Full Color or Reduced Color , the program will write a 24-bit image. Otherwise, it will write out an 8-bit image.
Another new format added to xv version 3.10. xv can now read and write 24-bit uncompressed Targa files. As such files are about the only reason folks still use the Targa format, this shouldn't be a problem. The color choices will do what you'd expect, but given that xv only reads/writes 24-bit Targa files, saving anything but Full Color would be a waste.
Saves images in the FITS format, a greyscale-only format used primarily by astronomers.
Note: This format is was developed at Penn, and is rarely seen outside of Penn. If you don't know anything about it, trust me, you don't want to.

Full Color images are saved in the 3-plane, 1-band, PM_C format. Greyscale and B/W Dithered images are both saved in the 1-plane, 1-band, PM_C format. As such, there is no size advantage to saving in the B/W Dithered format.

This is not an 'image file format' at all, which is why it appears separate from the rest of the formats in the Format menu. Instead of saving the current image, what this does is save a list of all the filenames in the xv controls window file list. This file list can be used in conjunction with the ' -flist ' option. See "Modifying xv Behavior" for more details.

This document was extracted from the PostScript documentation and formatted by Roy Johnson. Much of the process was automated, and may therefore have introduced errors. Corrections are appreciated.