The Levels command allows you to adjust the contrast, brightness, and gamma of an image. For color images you can adjust the three RGB channels separately or together.
Please note that this produces a "permanent" stretch, unlike the Screen Stretch window. As you make changes, they will be displayed on the screen immediately, without changing the image itself, but when you click OK the image data is actually changed.
The graphical histogram display shows all three channels for color images. If Log. Scale is selected then the vertical axis is shown logarithmically. That compresses the dynamic range so you can better see the information being presented (the Screen Stretch window also uses a logarithmic display). Otherwise it shows a linear scale. The graph can be resized by grabbing the "gripper" on the bottom right corner of the dialog box and moving it.
The Channel selector is used for color images only. If set to RGB, it adjusts all three color channels together. If set to Red, Green, or Blue, it adjusts only the individual channel.
The Output Range selector determines what data range is produced. The output can be 8-bit (compatible with JPEG, BMP, and similar file formats), 16-bit (compatible with FITS and TIFF in 16-bit mode), or 12-bit.
The Black control sets the "black point". Any pixel below that brightness level is set to zero. You can also adjust the black point by moving the red caret under the graph. Note that when you change the value by typing into the field, you must click the Update button to see the preview.
Similarly, the White control sets the "white point". Any pixel above that brightness level is set to the maximum value (saturation level) for the Output Range; for example, in 8-bit mode the saturation level is 255. The blue caret also adjusts the white point.
The Gamma control applies a nonlinear gamma correction to the image. A gamma of 1 has no effect; a gamma of greater than 1 will emphasize faint details, while a value greater than 1 will emphasize bright details. The gamma can also be adjusted by moving the green caret.
You can reset the values to their defaults using the Reset button. The default is a Gamma of 1 and the Black and White points are set to the original Screen Stretch settings.
If you have adjusted several color channels, then you can reset all of them simultaneously using the Reset All button.
When you click OK, the changes are made permanently to the image.