# DPlngScan

### The Colour menu

The Colour menu allows control of the colour of an image. This ranges from actually changing the colour to changing the number of bits used to represent it. Some of the colour options are very simple, others provide a lot of scope for experiment. As usual, the menu options will be dealt with in order.

#### Swop

This allows you to interchange the red, green and blue components of the image. It may be of use if for some reason the components have been confused or for effects. This function can be applied to a selected area as well as the entire image. The first entry rotates the colours - red becomes green, green blue and finally blue red. The other options swop two components.

#### Grey Scale

This converts a colour image to black and white, or in general a series of shades of grey. The weights used to do this can be set from the Choices dialogue box. These weights define how bright a colour is perceived to be. Because the eye is more sensitive to green light, green is given a greater weight. If a non-paletted image (more than 8bpp) is grey scaled it will automatically be converted to 8bpp with a linear grey scale palette. This produces a useful saving in memory, and loses no quality. Throughout the program, there is special code to deal with grey scale images, although they are always stored as 8bpp images with a palette.

### Change Format

This is probably one of the most complex functions in the program. The basic problem is taking an image with one bpp value and convert it into another image with a different bpp value. If the bpp value of the final image is greater than that of the starting image then usually there is a perfect mapping. The final image will look the same as the source image. Problems arise when the conversion is in the opposite direction from a larger bpp to a smaller one. There is also a case of converting between the same bpp but with a different set of colours in the source and destination image palettes. Some examples may make this clearer.

Many printing processes can only reproduce black or white dots (a 1bpp image) yet often one sees illustrations in shades of grey (perhaps 4 or 8bpp). This has been done for centuries by a technique called 'half-toning' (also called ordered dithering) which allows shades of grey to be represented by combinations of black and white dots.

To reduce the colour depth of an image algorithms such as Floyd Steinberg integration (FSI) are used. Colours are chosen so that on average they represent the colours in the original image. This is done by finding the closest colour to the current pixel, and then calculating an error. The error value is added to the value of the next pixel and the process repeated.

This is the Change format window. The icons on the left show the bpp and palette type of the original image. Those on the right the corresponding values for the new image. You can step through the values on the right with the arrow icons.

Three conversion methods are supported.

#### None

In this colours in the new image will simply be the ones closest to those in the old. This is sometimes called 'thresholding'. In the case of going from a grey scale image of 8bpp to a black and white image of 1bpp, pixels would always be black or white depending on if the value of the original was greater or less than a threshold value say 50%. Usually for realistic images this option is of little use, it may be more useful for getting 'posterised' effects.

#### FS

This is Floyd Steinberg dithering. It can give good results. Typically you would use this option to convert a 24bpp image that you had scanned and manipulated to 8bpp before saving it as a sprite for use in other programs or where it will be displayed on the desktop.

Zig Zag controls how the images are scanned. When selected the scan will change from left to right and right to left on alternate lines. In general Zig Zag will give the best results.

Simple controls how the error in the colour of one pixel is shared with its neighbours. When Simple is selected all the error is passed to the next pixel to be converted on the same line. This simple dithering is the same as is used for the main program display when 'Dither' on the tools palette is selected. When Simple is not selected, true Floyd Steinberg dithering is used, with the error being spread over both the next pixel, and neighbouring pixels on the next line. In general Simple not selected will give the best results. Using Simple may be useful if you want to get an image that is exactly the same as the one on screen.

Exact. By default colours are found using a lookup table of nearest values - this has limited precision. If Exact is chosen, a search for the nearest value will be carried out for each point. Exact takes a lot longer to do the conversion, but can give the best results.

#### Ordered

This is traditional half-toning. Results can be almost as good as FS dithering, and are usually a lot faster.

#### New bpp

It is possible to choose any of 1,2, 4, 8, 16, 24 or 32 for the new images bpp. It is important to set this. There's little point changing to the same bpp, unless the palette is different.

#### New palette

This can take various values.

#### RISC OS

The RISC OS palette is defined as that used in the desktop by default. In 8bpp modes there are limitations on the possible palettes. This is the most common setting for the new palette, since usually images will be for display on the desktop.

#### Optimal

If this is selected, the image will be analysed, and a palette created that represents it best. You use this if you want the best results, and are going to display the image on hardware that imposes no limitations on the palette.

#### RGB

This selects 'digital RGB' for the new palette. This means that the ranges of red, green and blue are split into equal parts. For example, in an 8bpp image, RGB can be given 5 levels each. This palette can be useful for producing images to be printed on printers that can reproduce red, green or blue dots with each dot being 100% on or off.

#### Linear GS

A linear grey scale palette. This can only be used on grey scale images.

#### None

This is used to indicate that the palette is the same as the original. However, when used in the old values icons, None indicates that the old image really does have no palette for example a 24bpp image.

### Colour Balance

This window, gives you a set of sliders that can be used to give global changes to the images colour. Changes can be applied to the entire image, or to a selected area.

The four values that can be changed, are related to the HSV colour model. The best way of understanding this, is via the colour wheel displayed by the palette window, and described below. The concept of brightness should be intuitively obvious. The brightness slider makes all colours brighter or darker. The contrast slider has a similar effect, except brighter colours have their brightness level increased more than dimmer colours. Note that the values shown are of changes to the image. If you enter a 5% contrast increase, and click on OK, then to get back to the original image, you have to enter -5% and click on OK again. An alternative method of reversing a change you have made is to use the Undo button in the info palette. This will guarantee that the change is absolutely reversed.

Remember also that these changes are cumulative. For example, increasing the contrast by 5% and then by 2% will result in a total contrast increase of more than 7%. When experimenting, the Undo button is your friend!

Saturation controls how close to grey colours are. By decreasing the saturation, you can gradually move an image towards being grey. Increasing the saturation makes the colours deeper and less like pastel shades.

Hue is related to the actual colour. Changing the hue, moves colours around the colour wheel in circles. It is almost like the colour swopping described above, instead of rotating RGB in a single large discrete step (green becomes red etc.), changing the hue allows this process to be done in small steps.

These operations are useful for correcting scans which have been done at the wrong values of brightness or are discoloured.

### Non-linear

This allows the most sensitive control of the brightness of an image. The graph on the left of the window shows the output brightness for each value of the input brightness.

The resulting change can be applied to the entire image or a selected area of it.

The buttons on the right of the graph section allow the mapping to be applied to the red, green or blue components individually or to all at once.

The buttons on the right hand side of the window set the form of mapping to be applied.

#### Step

In this the input is mapped to a discrete set of output values. Commonly called 'posterisation'. The levels of the bands in the graph can be dragged with the mouse select button.

#### Smooth

A line is drawn through a number of values. You can drag the points forming the line around.

#### Gamma

A common form of correction is to relate the input level (i) to the output (o) by o = iG. For G greater than 1 this will make the image darker, for G less than 1 brighter.

#### Threshold

In this the output is either 0 or 100%, and you can vary the point (threshold) at which the transition takes place.

#### Levels

This allows you to set the number of levels that there will be for the Smooth, Step and Threshold options.

#### Invert

When clicked on this will invert the mapping.

#### Linear

This makes the levels linear. It may be useful for getting back to sensible values after a session of editing them. It has no effect on the Gamma curve.

### Palette

Selecting this from the Colour menu will open the palette window. This can be useful just to see what the palette of the current image is. Using the palette you can choose the background colour to be used when an image is extended by the Edit tools (shear, rotate, extend), construct custom palettes, and finally set the colour and tint to be used by the selections on the rest of the Colour menu - Tint, Filter, Add and Subtract.

The top of the area, shows a small rectangle for each entry in the palette. The example has 256 as it would for an 8bpp image. For images with less bpp, there will be less entries. For images with more than 256 colours (16 or 32 bpp) then this area at the top will not show any palette, usually being black, since such images do not have a palette.

The four squares at the bottom show the current foreground, background and palette colours, and the mask.

Clicking with select on these icons transfers the colour to the colour selector (see later). Clicking with adjust transfers the colour selector to the colour.

If you click on the palette area with select that colour will become the one shown on the palette icon and the colour selector. Clicking in the palette area with adjust will transfer the current colour selector colour to the palette. A similar effect can be achieved by clicking on the Pal icon with adjust.

As well as choosing a colour, you can also choose a strength to go with it - a tint. This controls how much effect the colour will have when mixed with other colours. The central part of the palette window allows this strength or tint to be set. The icon under tint, shows the tinted and the original colour.

To display the colour selector, toggle the palette window to full size by clicking on the top right hand corner. The window will display this in addition.

The right hand part of the window, displays the 'current colour'. It can be shown in one of three models, RGB (red green blue, as used by video screen displays), HSV (hue, saturation, brightness which has some intuitive value) and CMYK (cyan, magenta, yellow, black, which is the same model as used in colour printing). The colour wheel displays a point in HSV space - think of it as a slice through a cylinder.

The colour model can be changed by clicking on the RGB, HSV or CMYK buttons. Sliders will appear for the quantities that can be altered. In the RGB and CMYK models there is an additional slider to control the slice through the colour cylinder that is displayed.

You can select colours by typing in values (percentages of red, green blue etc.), by clicking or dragging on the colour wheel, or by stepping through values with the arrow icons.

The process for using the colour selector is as follows.

- Click on a colour icon with select e.g. the Fg, Bg, Pal or the palette area icon.
- Modify the colour using the colour selector.
- Set a tint for the colour.
- Finally store the colour by clicking on one of the colour icons with adjust.

It is possible to get a colour from the current image, using the pointer tool, by holding down the SHIFT key and clicking with Select over the pixel of interest.

We now come to the final 4 selections on the colour menu.

#### Tint

Tint takes each pixel in the image, and mixes its colour with that of the current foreground colour. The effect is like mixing light. If the current colour is Yellow then all pixels will become more yellow. How great this effect is, is set by the tint of the current foreground colour. Do not confuse this Tint option with the tint property of colours.

#### Filter

This works like viewing the original image through a colour filter (like looking at a picture through a coloured piece of paper). Colour filters have interesting properties. For example if you look at a pure green object through a pure red filter it will appear black - because no green light can get through a red filter. Only pure red objects will be seen at full strength through a red filter. As usual how much effect the filter has is set by the tint of the foreground colour.

#### Add

The foreground colour is added at equal strength to all the pixels in the image. Again the tint of the colour controls the effect.

#### Subtract

The opposite of Add, the colour is subtracted.

The Filter menu | Index | Choices

DPlngScan is © David Pilling, 1993
Email:chris@chris-johnson.org.uk