Scanty - An Image Processing Routine
by Ledger White

The Scanty routine was originally published in RISC User 5:7. This version works in a window on the Desktop, allowing processing to take place in a multi-tasking environment.

Scanty is a routine for use with hand-held monochrome scanners which produce images in 'photo' modes by various dithering techniques. It was developed specifically for use with the Beebug A6 Scavenger package, but as these type of scanners are all very similar it will be of use with other makes. Note that using Scanty on sprites that are not raw output from a monochrome scanner will not produce the results expected.

The problem with the "anti-aliasing" function supplied with the hardware is its inflexibility. Scanty makes an improvement by offering a variety of averaging sizes and some limited control over contrast enhancement. The standard Archimedes will only display 16 levels of grey so a 256 level scanner has a limitation here - you can stick to your current monochrome scanner and still produce some very good output.

The Main Window
---------------
Running the application brings up the main Scanty window. The first law of image processing is that you need lots of RAM and for this reason Scanty does not sit on the icon bar hogging memory.

There are three sets of boxes: "lo med hi", a parameter which gives you some measure of contrast; "2 3 4 5 6", a parameter which sets the anti-alias averaging area; and "GO!" which starts Scanty converting the scanner's raw picture.

Using Scanty
------------
Run the Scanty application to bring up the Scanty window, and move this somewhere convenient on the screen. Now scan your image using Scavenger's 'photo' mode, or use an image scanned previously; then set your desired parameters on the Scanty window and drag the photo quality sprite to the window. The conversion will begin immediately and won't take long. When the conversion is complete a save box appears to enable the processed sprite to be saved.

If you don't like the result then change the parameters and click the "GO!" box - you don't need to re-load the sprite. If you want to convert another image then just drag it to the window to overwrite the previous one.

Note that "GO!" has no effect and the save box will not appear until you have first loaded a sprite. 

Sprites are output with their own 16 grey level palette and so you need to view them in a 256 colour mode or alternatively drag a suitable palette to the icon bar. Like Scavenger, Scanty images are mode 20 sprites. 

The Parameters
--------------
If your image is too light or too dark then adjust the contrast parameter accordingly. Note that it is true contrast adjustment where the grey levels are adjusted by different amounts, rather than brightness where they are all just changed by the same amount. Use the hardware's thumb wheel to select the appropriate brightness. 

The dither parameter number is the size of square used to calculate a single pixel. So "2" means that Scanty will add up the black pixels in a 2x2 square in the original to get the grey level in the output pixel. Thus there are up to 4 grey levels in parameter "2" and up to 36 grey levels in parameter "6". In practice I find that Scavenger gives up to 28 levels and these are formed by 2x2 dithering within the 6x6 original pattern. 

Scavenger output is based on a 3x3 pattern so the "3" and "6" parameters produce the best results (the anti-alias function supplied with Scavenger seems to use a 4x4 technique, which is why Scanty was written).

Since an output pixel is made up from between 4 and 36 input pixels and it uses 4 bits to repesent 1 of 16 grey levels:
output file size = input file size * 4 / dither.

So the "3" parameter gives a file only 4/9 as big as the original, and the "6" gives a file about 1/9 as big. Also, the "3" parameter makes a screen image which is about the same size as your original image, while the "6" one is about 1/4 the size. 

Happy Scanning!

 RISC User 1992
