| Image Menu The Image menu offers some of the most useful image manipulating functions in Gimp. In this chapter, we're going to discuss what you can do within the image menu. The Colors, Channel Ops and Alpha submenus will be covered in separate chapters.

## RGB, Grayscale And Indexed

| `Right-click|Image|``RGB`, `right-click|Image|``Grayscale` and `right-click|Image|``Indexed` are the three conversion options you have for your image. Normally, you'll work on an image in RGB color. If you know that you want a grayscale or indexed image, you can easily convert your image later. Some commands, filters and Script-Fus require grayscales, whereas others require RGB images.

Tip: All color information is irreversibly lost as soon as you convert to Grayscale, and a lot of color information is lost when converting to indexed.

Most commands, filters and Script-Fus give poor results or no result at all when used on indexed images. If you are using an indexed image, convert it to RGB immediately, and don't convert it back to indexed until you're finished with it! For more information on RGB, grayscale and indexed images, review "Color Models" starting on page 189.

### Indexed Palette Options

Select the `right-click|Image|``Indexed` command to convert an RGB or grayscale image to indexed. This will open the Indexed Color Conversion dialog box.

When you think of indexed images, you probably think about GIF images with a maximum of 256 colors. In general, however, you are free to specify any number of colors for an indexed image. To set the number of colors, press the Generate optimal palette radio button and type the number of colors you want into the # of colors box.

If you are doing web design, you should use the WWW-optimized palette to map the colors. You can also choose a custom palette from the drop-down list, or create a line art image by using a black/white palette for color mapping. The Enable Floyd-Steinberg dithering option helps to make indexed images look "good" even if they only include a few colors.

## Resize and Scale

### Resize

The `right-click|Image|``Resize` command is used to change the size and aspect ratio of the "canvas" where your image is placed. The scale and aspect ratio of the actual image and the layers within it are not affected. There are basically two reasons for changing the canvas size:

A. You're happy with the layers you have, but you need a new canvas size to make space for new and larger layers. When you resize the canvas, all new layers that you create will have this size and aspect ratio, unless you specify another width and height in the New Layer dialog box. The old layers, however, will remain as before.

B. You find that your layers are too small to contain things you want to add to them, or perhaps you wish to change the shape (aspect ratio) of your image without distorting the information within it. To resize an old layer, use the Resize Layer option in the Layers menu you get from right-clicking in the Layers tab (`right-click|Layers|``Layers` and `Channels|<layers>|``Resize` `Layer`).

#### The Resize Dialog Options

The dialog box displays a preview of what the proposed changes in size, aspect ratio or offset will look like. Set where on the canvas you want to place the image by dragging at the gray "image rectangle" in the dialog window, or by specifying a value in the X Offset and Y Offset fields.

If you check the Constrain Ratio checkbox, the proportions of the old canvas will be kept. If you uncheck Constrain Ratio and then change the proportions, Resize will either crop or add a transparent area to the image to fit the new size.

### Scale

`right-click|Image|``Scale` changes the size and aspect ratio of your image. Scale makes everything in your image larger or smaller, including layers.

If you check the Constrain Ratio checkbox, the proportions of the old image will be kept. If you uncheck Constrain Ratio and then change the proportions, Scale will stretch or compress the image to fit the new size, thus distorting the image.

#### Interpolating With Scale

When you enlarge your image with Scale, Gimp interpolates the new image. This means that when you add new pixels to an image, as you must when you make it larger, a process called interpolation will calculate the color and value of the new pixels based on the properties of the neighbor pixels. That is, an additional pixel between black-and-white original pixels will get a gray color.

The consequence is that the enlarged image will look better than the original image zoomed to the same size, but it will also lose sharpness and clarity. Read Interpolation to get more information about interpolation in Gimp.

## Histogram

`Right-click|Image|``Histogram` gives you valuable statistical information on the channel values for an entire image or for a certain pixel range in a channel.

The Histogram always refers to the active layer. Every spike in the histogram represents pixels with a defined value. The higher the spike, the more pixels of that value in the image. The 256 spikes, one for every value, are ordered in a sequence from left to right, starting with low values to the left and continuing with increasing values to the right. You can chose a certain value or value interval by clicking on a spike or clicking and dragging at a part of the histogram.

### Histogram Parameters

· Mean is the mean value of that interval. This figure will give you an approximate value of the range you're interested in.

· Intensity tells you the value (from 0 to 255) of the chosen pixel spike, or the value of the first and last spike in a chosen interval. You can, for example, select an interval where there seems to be a large number of pixels and find out where on the brightness/darkness scale those pixels are.

· Std Dev (Standard Deviation) is how homogeneous the pixel spike height is in a certain range. It tells you whether the pixels in a certain interval are equally distributed over that range (this usually means that there are many different shades and soft transitions in the image), or whether you can only perceive a few shades within a certain value or color range.

· Count refers to the number of pixels a spike or interval represents.

· Median is the median of the interval, i.e., the value of the fiftieth spike if you have chosen an interval of 100 spikes.

· Percentile is the percentage of the total number of pixels in a selected range. This tells you how large that part of your image is.

· Pixels tells you the total number of pixels in the active layer.

## Save Palette

`Right-click|Image|``Save` `palette` will create a palette of colors from an indexed image. When you are manipulating indexed images, this option lets you save the colors in your images, so that you can organize colors and easily pick the color you want.

When you convert an image to indexed (`right-click|Image|``Indexed`) you set the number of colors you want in the Indexed Color Conversion dialog box. This also sets how many colors will be in a palette created from that indexed image.

### Creating A Palette From An Indexed Image

Select `right-click|Image|``Indexed` to convert your image to indexed. Choose how many colors you want for your palette and type that number into the # of colors: box. Click on the OK button and your image will be converted to indexed format.

`Right-click|Image|``Save` `palette` will display the Export GIMP Palette dialog. Type in a name for the palette, and press the OK button (the dialog is already in your personal palette directory so there's no need to change the directory).

Back on your image, press Ctrl+z to Undo the indexed conversion and return your image to RGB.

Open the Color Palette dialog (with either `right-click|Dialogs|``Palette` or `File|Dialogs|``Palette`). Choose Refresh Palettes from the Ops pull-down menu to refresh the palettes. Now, the palette you just created should appear in the pull-down palette menu, and be available for you to use.

## Transforms

### Autocrop

`Right-click|Image|Transforms|``Autocrop` crops images automatically. If you paint or paste something onto a large solid or transparent background, you may find that you have too much space around the image object.

Autocrop will crop your image so that everything but the important parts are cut away. Note that if you work in a layer, Autocrop will crop the entire image with no concern for the other layers.

### Image

`Right-click|Image|Transforms|Image|``Rotate` `270` or | `Rotate` `90` lets you rotate the entire image either 270 degrees or 90 degrees. This is useful for changing scanned images to either landscape or portrait mode.

### Layer

`Right-click|Image|Transforms|Layer|``Rotate` `270` or `Rotate` `90` allow you to rotate a layer 270 degrees or 90 degrees. Remember that when you rotate a large layer, portions of it will disappear outside of the image boundary.

### Mirror

`Right-click|Image|Transforms|``Mirror` reflects your image as a mirror would. The difference between Mirror and the Flip tool is that with Mirror, you can flip all layers at the same time by checking the Mirror the whole image checkbox.

### Rotate

`Right-click|Image|Transforms|``Rotate` provides a simple way to rotate your image or selection 0, 90, 180 or 270 degrees. Rotate is very convenient for reorienting scanned images.

### Zealous Crop

`Right-click|Image|Transforms|``Zealous` `Crop` works much like the Autocrop filter, but there are some significant differences. While Autocrop cuts away any peripheral parts of the image that have no variation in color or alpha, Zealous Crop moves objects closer together (but not on top of each other) before cutting.

When Zealous Crop finds objects of a different color on a solid or transparent background in the same layer, it moves the objects as close to each other as possible without them overlapping, so that they remain in the same relative positions to each other. Zealous Crop lets you keep all of the objects in your image, but reduces the size as much as is possible without scaling the image.

Zealous Crop works on all layers, but only compresses the objects in the active layer. Zealous Crop always crops the upper-left part of inactive layers, while Autocrop crops all layers in the position determined by the active layer.

Frozenriver Digital Design http://www.frozenriver.nu Voice: +46 (0)31 474356 Fax: +46 (0)31 493833 support@frozenriver.com | Publisher Coriolis http://www.coriolis.com