Previous Next TOC Index Feedback


Fourteen

Chapter


 

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 with Colors and Channel Ops.

 

Colors

The first part of the Colors menu deals with how image pixels are mapped to different RGB values. The second part deals with color correction.

Extracted pic [1]

Equalize

Equalize is often used to correct over- or under-exposed photos. This command finds the darkest and lightest pixels in the image, and sets the darkest value to black, and the lightest to white. The intermediate colors are then translated to the correspondent histogram values on the new scale. By doing this, it equalizes the image pixels on a wider scale or spectrum than before. The result is usually harder and much clearer, with more saturation and contrast but often less fine detail. Equalize can be used to find "hidden" colors in old, fading photos, because colors are also equalized. If there is a weak shade of green somewhere in a seemingly solid blue area, equalize will find it and strengthen it, while the blue color will lose in intensity. Sometimes this behavior means that colors will look a bit unnatural after equalization, so you might have to correct it further by using the color correction tools. For adjusting old photos, it is sometimes better to use Autostrech HSV, Contrast Autostrech and Normalize. You'll have to try all and see which is most suitable for your picture.

Invert

Extracted pic [2] Invert creates a color negative of your image (or a positive of your negative). This is very useful if you have a slide scanner, because then you never have to worry about expensive developing. You need only develop the negative film, and then you can do your own developing in the computer. The calculations are quite simple; the inverted RGB value of a pixel is 255 minus the former channel value. Read more about inverted or complimentary colors in Chapter 12.

Posterize

Extracted pic [3] Posterize is a way of creating an "indexed" image, where the colors are not derived from the image, but from the number of possible combinations the three RGB channels can produce. The available colors depend on what Level you set in the Posterize dialog.

For a grayscale image it's easy. Level 0, 1 and 2 produce the minimum of colors possible - black and white only. For each level you get one more grayscale. Level 4 equals four shades of gray, level 16 equals 16 shades of gray etc.

In an RGB image, Level 4 equals four different shades in each color channel. This means that level 4 equals 4*4*4, which is 64 colors. Because those 64 colors have nothing to do with the original colors in the image, only a few of them will be used in the image. A posterized image will be a lot less representative, but (perhaps) more "artistic" than an indexed image, where the chosen colors are taken from the image.

Threshold

Extracted pic [4] The Threshold dialog displays a brightness histogram of the image. Each spike in the histogram represents an intensity value ranging from 1 to 255. The longer the spike, the more pixels with that particular value. In the preview you can see where those pixels are situated in the image.

Clicking on a single spike will only display pixels with that particular value, while dragging from one spike to another, will display all pixels with a threshold range from the first value to the second.

Lineart

Extracted pic [5] If you want to make a Lineart (Black and White) image, this is the command to use. It is also an excellent tool for selecting by Value! If you copy your image to an Alpha Channel, and use threshold on that, you can for example select all pixels dark enough to represent a certain shape, and use that to make a selection.

Color Balance

Extracted pic [6] Color Balance allows you to adjust the color levels in your image. Color Balance changes colors in the image, but not so drastically as Hue-Saturation. Use Color Balance when you want to make subtle changes in color.

In the dialog box you'll find three slide bars ranging from the three RGB colors to their complimentary colors (CMY). As you know if you have read the chapter about color, the sum of two complimentary colors is neutral gray. You can consider your current pixels "neutral" and any change you apply will draw the pixel color either toward Red or Cyan, Green or Magenta, Blue or Yellow.

Note that drawing all three slide bars against the CMY (additive) colors will darken your image, while drawing them toward the RGB (subtractive) colors will lighten the image.

There are also three buttons for Highlights, Midtones or Shadows. By pressing one of these buttons, you choose whether you want to change the darkest pixels, the medium pixels or the brightest pixels. The Preserve Luminosity button makes sure that the brightness value of your image doesn't change. By default this option is unchecked, the colors can get very unnatural if you insist on keeping the original values while changing the color balance.

Extracted pic [7]

Brightness-Contrast

Extracted pic [8] Brightness-Contrast is easy to understand. The zero values represent the current values of your image. From that point of departure, you can raise or lower the amount of contrast and brightness.

Extracted pic [9]

Hue-Saturation

Extracted pic [10] The Hue-Saturation dialog lets you adjust Hue, Saturation and Lightness (Value). It is important to understand that this option is entirely based on the HSV color model. Read more about HSV in Chapter 12.

When you change Hue with the Master button checked, all pixels in the image or selection will change color according to how many degrees you have turned the HSV color circle. If you just want to change part of the spectrum, you can choose one of the color swatches.

Hints

Extracted pic [11] You must remember once again, this is HSV - not RGB. This explains why checking the Yellow button doesn't necessary change the yellow parts in your image.

Because this is HSV, the yellow swatch starts at 100% pure yellow on the HSV color circle (no orange shade whatsoever allowed) and continues toward Green. Everything in the yellow-green cake slice is affected by changes to hue, saturation or value. Yellow pixels get the color you see in the swatch, and greenish pixels get the color next (clockwise) to the swatch color, more and more so the greener they get. To affect the yellow pixels which were slightly to the red side, choose the red swatch instead. The red swatch changes all color between pure red and yellow. This fact can make Hue-Saturation unsuitable for certain images. For most images, it's very useful indeed, but if you have trouble with it, try Colormap Rotation in the Filters/Colors menu instead (there are very few things you can't achieve with that filter).

Extracted pic [12]

Curves

The Curves tool is a fantastic instrument for changing color and brightness of an image or a certain color/brightness range in an image. As a matter of fact, it's so versatile that it is quite hard to describe.

Extracted pic [13]

Workflow

Simply put, the image's RGB values (and possible Alpha values) are represented by curves, and you can change a curve anyway you like by dragging at different parts of it.

Extracted pic [14] When you first open Curves, you'll see a straight linear curve. This curve is called Value and represents the values of all three RGB channels of the current image. Value in this option does not mean value as in HSV. Curves is based entirely on RGB values, and when you change the Value curve, you'll affect all of the color channels.

Remember the Threshold command? When you looked at your image with Threshold, you could choose an area from spike A to spike B, and that area represented pixels of intensity A, ranging to intensity B. It is the same way with Curves; The left part of the curve represent the darkest pixels in the image, and the right part represents the lightest pixels. There is a grayscale gradient to the left of the curve. This gradient tells us what brightness value the curve follows. To understand Curves better, you have to open an image and try it.

Try dragging at the middle of the curve, up to the left, and down to the right. While you are doing this, take a look at the gradient below the curve. First of all, you'll find that dragging down makes your image darker, and dragging up makes it lighter. Remember that you dragged in the middle of the curve. The middle represents pixels with midvalues. By making a soft curve in this fashion, you have changed the midvalues a lot, but you have only changed highlights and shadows a little, so you have less contrast now. If you check out the lower gradient, you'll see that the balance of dark and light has been changed, you can also see where on the scale this happened and with how much. If you are in a color channel, this procedure will turn pixels a lot more/less (green/red/blue). In a Color channel dark means pixels with little of that color, and light means pixels with a lot of that the color in them. If you are changing Alpha, it's the same - dark stands for low Alpha value (or very transparent).

You may have noticed that there are two dots at the ends of the curve. Drag at these dots. You'll find that the line to the left/right of the dots is perfectly straight. In practice, this means that dragging the left dot constrains a range of dark pixels to the same value. How large this range or interval will be depends on the horizontal length of the line. How dark it will be depends on where you put the dot on the vertical scale.

Click at different places on the curve. Each click produces another dot, and you can move each dot independently of the others. You can move them up, down or along the curve. These dots are like Bezier anchor points, but without the handles. This means that by moving a dot, you'll produce a little curve between the two nearest dots. This way you can easily pick a suitable pixel range, and only change the values within that range. To get rid of dots, drag them toward one of the end dots. You can choose to get rid of all dots except one, but having only one dot means that your curve is flat. A flat curve causes all values to be the same; and this means your image will turn gray and disappear (or, if you're in the red channel, all pixels will get the same red value).

Because this is a Value based on RGB, you can sometimes get an unwanted color change where you only wanted to change the pixel brightness. This happens when you try to make extreme changes, like turning a very dark object light without disturbing the other colors in the image. Doing this will only invert the color, and you'll just end up with something red if the object was green. There are many solutions to this problem. You can for example isolate the object in a selection and use Value Invert in the Filters/Colors menu. This filter works in HSV space, and inverts Value without changing Hue or Saturation.

The option Curve Type: Free, lets you create or modify your curve with a pencil, which offers unlimited possibilities of fine-tuning colors or values. Pressing Smooth will get you back to a smoother version of the same curve. To learn more, you have to keep experimenting by yourself.

Levels

Extracted pic [15] Levels is another way of manipulating RGB properties. Levels is an excellent tool for making highlights or shadow areas for 3D enhancement. It is also good for putting emphasis on a certain range. While Curves only affect the chosen range, Levels also changes the pixels outside of that range. When you use Levels, you're usually only interested in a defined range, like the brightest or darkest parts of the image.

When you open the Levels dialog, you'll see a histogram of your image's Value (all RGB Channels) or of the Red, Green, Blue or Alpha Channel. Take a look at the histogram and the little arrows beneath it. The black arrow represents minimum value in the RGB channels, the white arrow represents maximum value and the gray arrow represents the mid value (127 on the RGB scale). The area between the black and white arrows define a certain pixel value range.

Levels on Grayscale

If you're working with a grayscale image, every pixel to the left of that range turns black, and everything to the right of it turns white. Within that range you can decide how the brightness value is going to be distributed through the transition from light to dark. If you're working with an RGB color image, the areas outside of the range will consist of the primary colors and their derivatives (CMY, RGB, BW).

If you drag the black arrow to the start of the histogram, the white arrow to the end of it and put the gray arrow in the middle, you have pretty much done the same thing as Equalize does, i.e. broadened the spectrum of the image. If you keep moving the arrows toward the centre, you'll get more contrast and less detail, because the range is narrowing down. Try and move the gray arrow. Moving it to the left adjusts the brightness scale so that more and more of the pixels get brighter, and vice versa. Also try the Output levels gradient. The output levels control the overall brightness value, the entire image or drawable gets darker or lighter - always with less contrast than before.

Extracted pic [16]

Levels on RGB or Alpha

When you switch to a color channel, you must remember that we're no longer talking about dark and light, we're now discussing the quantities of color in the image. Dark in the grayscale gradient means low values of the color in questions, and light is for pixels with a lot of that color in them. The outcome of moving the arrows in a color channel isn't as obvious as with Value, it depends on how much there is of the color, and in what range most of the color is found. The Output gradient controls the value range pixels are allowed to use for a certain color. By this I mean if you set the Output to 100 - 120, all pixels with a little green in them, (even if it's a very low value) get a new green value, which is at least 100, and no pixel gets a higher value for green than 120. Dragging the white arrow to the left causes the image to get less green (i.e. more red), and vice versa for the black arrow.

What is true for the color channels is also true for Alpha. Here, dark means low Alpha (transparent) and white is high Alpha (fully opaque or solid). When you use Levels on Alpha, you should use it for advanced selections from an Alpha Channel or a Layer Mask, i.e a selection with great variation in Alpha values. Otherwise it will be a bit like trying to use Levels on a solid white square on black background - there isn't really much you can do with it.

Example: Making Carved Text with Levels

To make you understand what Levels are good for, check out this example.

Extracted pic [17]
  • 3. Choose the Text Tool and write a few (black) letters on the background. Use some Gaussian blur (the more you use, the more bevel and softness you'll get).
  • 4. Activate the white layer and choose Bump Map in the Filters/Map menu.
  • 5. Choose the background to bumpmap.
Extracted pic [18]
  • 6. You should now have a nice 3D image of the letters in your layer. Use some more Gaussian blur if you like, and duplicate the layer.
  • 7. Now it's time to use Levels! Activate the top layer and move the black and gray arrows to the right, until you see the bright highlights of the letters on top of a black background.
Extracted pic [19]
  • 8. Activate the other layer and move the white and gray arrows to the left, until you see the shadows on top of a white background.
  • 9. Change the Mode of the highlight layer to Screen.
  • 10. Change the Mode of the shadow layer to Multiply.
  • 11. Fill the background with a suitable color or pattern.

Desaturate

With Desaturate you can choose to remove color from a layer or selection without disturbing the rest of the composite image. Desaturate does not turn your image into a grayscale, it's still RGB, even if there is no visible color.

Extracted pic [20]

Auto-Stretch HSV

Extracted pic [21] This filter makes an automatic contrast stretch of your image. It does this by finding the lowest and highest values of each HSV channel, and stretch this to the full contrast range. This is similar to Contrast Auto-Stretch but Contrast Auto-Stretch works in RGB space. Auto-Stretch HSV is a great filter for enhancing or correcting old pictures. If you test it on some old, faded images, and it doesn't work, you can always try Equalize to see if that does the trick. The filter can also be used to do HSV stretching for other purpose than image enhancing. If you really want to know how it works, just bring up a histogram before and after using it.

Contrast Auto-Stretch

Extracted pic [22] Works just like Auto-Stretch HSV, but in RGB space. This plug-in does a great job removing undesired color tints. As you may have noticed, this plug-in is also a wonderful image enhancer for poor quality photos, or faded images. It's also good for badly scanned images.

Normalize

Extracted pic [23] This filter is rather similar to Contrast Auto-Stretch, but it won't allow the RGB channels to stretch independently. Instead they are treated as a union. The technical difference is that with Normalize, all channels will not stretch over the whole range from 0 to 255. This is a filter you will use a lot if you are dealing with scanned images and other image enhancements.

 

Channel Ops

The Channel Operations deal with channels, but in very different ways. Duplicate includes all layers and channels in a composite image, while Offset only affects the active layer/channel. Decompose uses channel information from the active layer and creates new grayscales, and Compose transforms grayscales to channels, thereby creating a new RGB image.

Duplicate

Duplicate creates a copy of your image. This is a very useful command, so make sure you use it every time you want to experiment with different solutions and variations in an image.

Offset

Extracted pic [24] Offset can be used for placing layers or floating selections. Offset is useful if you want to move layers in a very exact way, or if you'd like to move them without changing the layer border. Wrap-Around means that the parts of the image which ended up outside the layer border, will turn up on the other side of the image. If you don't want this, you can choose to fill the empty area with background color or transparency.

Tips

Another useful aspect of Offset is the possibility of making seamless tiles. If you want to make a wallpaper pattern of your image, it's a good idea to check how well the edges fit, before you tile it. If you choose Offset by..., and check the Wrap-Around button, you'll split your image in four equal tiles. To achieve a seamless tile, you'll have to try and erase the sharp borders between the tiles. There are many ways of doing this, depending on how complicated the image is. You can use the clone tool and the transform tool, you can paint, copy and paste suitable selections with different opacities, or use special filters. When your happy with the result, choose the Offset by... option again, and your image will return to normal, but now with seamless edges which will produce a perfect result when tiling the image. There is a filter called Make Seamless in the Filters/Map menu which also produces seamless tiles. Tiling looks very good with this filter. The drawback is that you can never get really sharp patterns with it - everything looks a bit blurred and double-exposed.

Extracted pic [25]

Compose and Decompose

Extracted pic [26] Decompose is a way of extracting channels from an image. Compose merges (at least three) grayscale images to one color image. You can break up your image into its constituents, by choosing to extract RGB, HSV, CMY(K) or Alpha channels.

Extracted pic [27]

RGB decomposing

Decomposing to RGB is really the same as activating a color channel in the Layers & Channels dialog, but now you'll get them as three different grayscale images. You can do a lot of things with decomposed images. The first thing that comes to mind is to edit them in different ways, and then use Compose to put them together again. Another way of using Decompose is to save an extracted grayscale as a selection or mask in a channel. Sometimes there is very little of a certain color in the background compared to an object in the image. This gives you the perfect opportunity to create very exact selections of intricate objects. You can also play around with compose/decompose, and create interesting patterns.

Extracted pic [28]

HSV decomposing

The HSV decompose option creates three different grayscales, one for Hue, one for Saturation and one for Value.

It may seem strange that a grayscale image can describe color, as in Hue, but consider the HSV color circle. Imagine a circular gradient where white and black meet in the start and ending point on the circle. Pure black and white represent red, which is on top of the HSV color circle. Dark gray equals orange or yellow, and medium gray tones represent green or cyan. Accordingly, light grays represent blue and magenta.

The Saturation and Value grayscales are easier to understand. White represents pure, strong color (saturation) and maximum brightness (value). Black means completely desaturated gray(saturation) and, well, black (value).

Extracted pic [29] From this we can derive that if you want something to be white in a HSV based image, Saturation in that area must be set to black, and Value to white. The big difference between RGB compose and HSV compose is that the grayscale information means very different things for Hue, Saturation and Value, while gray in RGB channels just represents the concentration of a certain color. This also explains why it is possible to manage with just one grayscale, when you are composing to HSV. If you were to use the same grayscale for composing RGB, the result would be exactly the same as the original grayscale. If you did the same for CMYK, you'd just end up with an overbright negative of the image (if the image was inverted you'd get a very dark grayscale).

CMYK & CMY decomposing

The CMY or CMYK decompose option is interesting if you are thinking of putting your work to print. Using CMYK decompose is actually the same as making your own color separation for four-color printing plates. In principle, you can use CMYK decompose, print the outcome on a laser printer, and give it to a professional print shop. However, the professional printer would most likely do a much better separating job than you can, so I don't recommend this solution. You can certainly achieve very interesting results with CMY/CMYK decomposed images, even if you don't use them for printing purposes.

Extracted pic [30]

Alpha decomposing

Alpha decompose is a fast and easy way of converting semi-transparent layers to the equivalent grayscale. You can certainly do the same thing if you copy and paste the layer to an Alpha channel or a Layer mask, but with Alpha compose/decompose you don't have to worry about copy/paste to Channel, or transforming to selection and filling when you want it back in the layer again. It's a real convenient way to edit Alpha layers, and a worthwhile alternative to editing in the Channels menu. Another great advantage is that decomposing an Alpha layer twice (Alpha decompose as well as RGB decompose) allows you to retain original structure, color and Alpha after editing, because you can compose to RGBA, which includes all channel information.

 

RGB, Grayscale, Indexed

Extracted pic [31] These are the three conversion options you have for your image. The natural choice, when you start working with an image is of course RGB. If you know that you want a grayscale or an indexed image, you can easily convert your image later. Some commands, filters and Script-Fu's require grayscales, while others require RGB images. Just remember that 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. Remember that most commands, filters and Script-Fu's give horrible or no result at all when used on indexed images, so 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! Read more about Color Models in Chapter 12.

Indexed options

When you think of indexed images you probably think about GIF images with a maximum of 256 colors. However, this is no limit for indexed images in general, you are free to specify any number of colors. If you are dealing with web design then it's a good idea to use the WWW-optimized palette to map the colors. You can also use a personal palette for color mapping. A nice option is the Floyd-Steinberg dithering that helps make indexed images look "good" even if you only have a few colors in it.

Extracted pic [32]

 

Resize and Scale

Resize

The major difference between Image Resize and Image Scale is that Resize only changes the canvas size, while Scale changes the actual size and scale of your image. Note that when you enlarge your image with Scale, Gimp interpolates the new image. Interpolation means that an additional pixel between black and white original pixels will get a gray color. This means that the enlarged image will look better than the original image zoomed to the same size, but it will also lose in sharpness and clarity.

Scale

Extracted pic [33] Scale makes everything in your image larger or smaller, including layers, but Resize doesn't change the size of the layers. To do that - use the Resize Layer option in the Layers menu. You have to change the layer size if you mean to use the new canvas in a meaningful way (unless you're happy with the layers you have, and only wish to use the new size for new layers). You can determine where on the canvas you want to place the image by using X- and Y Offset. The dialog window gives a preview of what the proposed changes in size or offset will look like, and you can choose to keep the proportions of the old image by checking Constrain Ratio. 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. Resize will never distort the image, it will either crop or add a transparent area to the image to fit the new size.

 

Histogram

Extracted pic [34] A Histogram gives you valuable statistic information on the channel values, or of a certain pixel range in a channel. The histogram always refers to the active layer.
  • Intensity refers to what value from 0 to 255 a certain pixel spike has, or the value of the first and last spike in a chosen interval.
  • Mean informs you of the mean value of that interval.
  • Count refers to the number of pixels in a spike or interval.
  • Standard Deviation tells you how homogenous the pixel spike height is in a certain range.
  • Percentile tells you how many percent of the total number of pixels there are in a certain range.
  • Median tells you what the median of the interval is.
  • Pixels tells you the total number of pixels in the active layer.

 

Alpha

Holes

This plug-in requires a layered image. As you may have noticed, indexed images like GIF don't support semi-transparency. Holes creates a rather convincing illusion of semi-transparent pixels (at least if you compare it to a dithered Netscape image in 8-bit mode). You can of course use Dissolve to achieve a similar effect, but this is a slicker way. In order to make this look good, you must use a small Hole Size (like 1) and a medium to low Density (like -1.50) with the Keep Opaque button checked. If you don't use Keep Opaque, you'll risk getting spillout or "dot pollution" on the transparent areas of the image. This is undesirable behavior if you're trying to create a semi-transparent look in a GIF, but if you're not, this option can result in quite nifty effects. Depending on what effect you want, you may change the shape and size of the holes, you can choose from square, round and diamond, though round and diamond shaped holes require a minimum size of (2).

Threshold Alpha

This filter lets you remove pixels by their alpha value (transparency). The outcome of this filter is always totally transparent or solid (never semi-transparent), so it's a great tool for controlling the appearance of an image that you want to save as a transparent GIF. The slide bar value determines what values you want to remove. If you set a high value, only pixels with an even higher alpha (more solid) will remain after the filter is applied.

 

Save palette

When you are dealing with image manipulation you often want to transfer the colors in your image to a palette so you can easily pick the color you want. This tool will extract a palette from an indexed image. The number of colors in the index dialog also sets the number of colors in your palette. Here is the workflow: Index your image and choose how many colors you want for your palette. Invoke Save Palette to bring up an ordinary Save dialog. Type the name of the palette, and press Save (the dialog is already in your personal palette directory so there is no need to change the directory). Now, press Ctrl-Z to bring back your image to RGB. Now you're almost ready to use your new palette. You just need to restart Gimp before you can use it, because Gimp needs to refresh the palettes.

 

Transforms

Autocrop

This filter crops images automatically. If you paint or paste something in a large solid-color or transparent background, you may find that you have put too much space around the image object. If you then apply Autocrop it will crop your image so that everything but the important parts are cut away. Note, if you work in a layer, Autocrop will still crop the entire image with no concern of the other layers.

Image

Lets you rotate the image 270 or 90 deg.

Layer

Allows you to rotate a layer 270 or 90 deg. Remember that when you rotate a layer, some parts of it will always disappear outside of the image boundary.

Rotate

A simple way to rotate your image or selection (must be single layered) 0, 90, 180 and 270 deg. Quite nice when you are scanning images.

Zealous Crop

This filter works much like the Autocrop filter, but there are some significant differences. While Autocrop cuts away peripheral parts which have no color or alpha variation, Zealous crop uses compression before cutting. When this plug-in finds objects of different color on a solid-color or transparent background (in the same layer), it will squeeze those objects together as tight as possible without overlapping, but they'll keep the same formation (relative position) as before. This way you get to keep all your stuff inside of your image, which is now as small as it can possibly be without scaling. Zealous Crop cuts through all layers, but it only uses compression on the active layer. Z-crop always crops inactive layers at the upper left part, while Autocrop crops all layers in the position determined by the active layer.

 


The Gimp User Manual
Last modified: 19 May 1998

Previous Next TOC Index Feedback