XV: The Color Editor, part 1/3

# The Color Editor

## Overview

The xv color editor provides a powerful system for manipulating color images. Since there are many different reasons why a person would want to modify an image's colors, and many different types of images that may need modification, there is no one color manipulation tool that would be 'best' for all purposes. Because of this problem, xv gives the user three different color tools, all of which can be used simultaneously.

Colormap Editing: This tool lets you arbitrarily modify individual colormap entries. Useful for modifying the color of captions or other things that have been added to images. Also works well on images that have a small number of colors, such as images generated by 'drawing' or CAD programs. It's also an easy way to spiff up boring 1-bit black and white images. Note that the Colormap Editing tool is not available when you are in 24-bit mode.

HSV Modification: This tool lets you alter the image globally in the HSV colorspace. (See "RGB and HSV Colorspaces" for more info.) Here are examples of the sort of things you can do with this tool:

- turn all the blues in an image into reds
- change the tint of an image
- change a greyscale image into a mauve-scale image
- increase or decrease the amount of color saturation in an image
- change the overall brightness of an image
- change the overall contrast of an image

RGB Modification: This tool lets you route the red, green, and blue color components of an image through independent mapping functions. The functions can either be the standard gamma function, or any arbitrary function that can be drawn with straight line segments or a cubic spline. See "The Intensity Graph" for more info about graph functions.

The major use of the RGB Modification tool is to correct for the differing color response curves of various color monitors, printers, and scanners. This is the tool to use when the image is too red, for instance.

These three tools are tied together in a fixed order. The Colormap Editing tool operates on the original colors in the image. The output of this tool is piped into the HSV Modification tool. Its output is piped into the RGB Modification tool. The output from the RGB Modification tool is what actually gets displayed.

In addition there is a collection of buttons that control the xv color editor as a whole (more or less).

Don't Panic! It's not as complicated as it looks.

## The Colormap Editing Tool

| The top portion of this window shows the colormap of the current image. There are 16 cells across, and up to 16 rows down, for a maximum of 256 color cells. Only cells actually used somewhere in the image are shown in this array. The currently selected color cell is shown with a thick border. You can change the selection by clicking anywhere in the array. If you drag the mouse through this area, you'll see the dials at the bottom change to track the current pixel values. You can also select a color cell by clicking anywhere in the image window. Whichever pixel value you were on when you let go of the mouse will become the new selected color cell.

You can define a smoothly gradated range of colors by Left clicking on the color cell that marks the 'start' of the range, and Middle clicking on the color cell that marks the 'end' of the range. Intervening color cells will be interpolated between the colors of the 'start' and 'end' colorcells.

Since certain images will have many colors that are the same, or nearly the same, it is sometimes convenient to group color cells together. Grouped color cells all take on the same color, and changing any one of them affects all of the other colors in the group.

To group color cells together, do the following:

1. Hold down the <Shift> key.
2. Left click on one color cell that you would like to be in the group
3. Right click on other color cells that you wish to be in this group. (Right clicking on cells that are already selected will de-select them.)
4. Release the <Shift> key when you're done.

You can create as many groups as you like.

You can use this grouping/ungrouping technique to copy colors from one color cell to another. Left click on the source color cell, Right click on the destination color cell, and Right click on the destination color cell again (to ungroup it).

### Using the Dial Controls

At the bottom of the Colormap Editing tool are three dials that let you set the color of the current color cell (or group of cells). By default, the dials control the Red, Green, and Blue components of the RGB colorspace, but they can also control the Hue, Saturation, and Value components of the HSV colorspace. (The RGB/HSV button controls this.)

Regardless of what they control, all dials in xv work the same way. Clicking on the single arrows increase/decrease the value by 1. Clicking on the double arrows increase/decrease the value by a larger amount (16 in this case). If you click on one of the arrows, and hold the mouse button down, the increase/decrease will repeat until you release the mouse button.

You can also click in the general area of the pointer and simply drag it to the position you want. The further your mouse cursor is from the center of the dial, the more precise the control will be. While dragging, you do not have to keep the cursor inside the dial window.

### Colormap Editing Commands

  Undoes the last change made to the colormap that resulted in a color cell changing value. This includes grouping and ungrouping color cells, and changing any of the dials.
  Undoes all color changes. Returns the colormap to its original state. Destroys any groups that you may have created.

  Toggles the Colormap Editing dials between editing colors in terms of Red, Green, and Blue, and editing colors in terms of Hue, Saturation, and Value. |

  Turns color images into greyscale images by changing the colormap. This replaces each color cell with a greyscale representation of itself. Use the Revert command to restore the colors.
  This command behaves differently, depending on the setting of the RGB/HSV mode. (You can tell which mode you're in by the titles on the dials.)

  In RGB mode, each color component is separately 'inverted'. For example, Yellow (which is composed of full red, full green, and no blue) would turn to Blue (no red, no green, full blue).

  In HSV mode, only the Value (intensity) component is 'inverted'. The Hue and Saturation components remain the same. In this mode, bright colors turn to dark versions of the same color. For example, a Yellow would turn Brown.

  Generates a random colormap. This is of questionable usefulness, but it will occasionally come up with pleasing color combinations that you never would've come up with yourself. So it stays in. It works best on images with a small number of colors. Note that it respects cell groupings, so if your image has a lot of colors, you can create a few large groups and then use the Random command.

Note: It is HIGHLY RECOMMENDED that if you're using the Colormap Editing tool, you do not use either the HSV Modification tool or the RGB Modification tool. If you do, the results can be quite confusing. For example, you might edit a color cell, and set its color values to produce a purple. However, because of HSV/RGB Modification further down the line, the actual color displayed on the image (and in the color cell) is yellow. It confuses me, it'll probably confuse you, too.