============================================================================
                   ChangeFSI command line and BASIC usage
============================================================================


This file gives the command line syntax of ChangeFSI, details of options not
available from the desktop, and examples of use. It also tells you how to
use it as a BASIC library. Finally there is an important note about certain
system variables that must be set to ensure full functionality.


*ChangeFSI
==========

Changes source image to output image, with optional scaling and processing.

Syntax
------
ChangeFSI [<in file> <out file> <mode> [<scale> [<y scale>]] [<options>]]

Parameters
----------
<in file>       A valid pathname specifying the source image

<out file>      A valid pathname specifying a file to hold the output image

<mode>          The file format used to output the image. Valid modes are:
                AIM             output as AIM
                JPEG[MONO]<n>   output as JPEG (JFIF); <n> sets the quality
                                of the output image in the range 0 to 100
                p1              output as pbm (black & white), ASCII encoded
                p2              output as pgm (grey), ASCII encoded
                p3              output as ppm (colour), ASCII encoded
                p4              output as pbm (black & white), binary encoded
                p5              output as pgm (grey), binary encoded
                p6              output as ppm (colour), binary encoded
                p15             output as p15
                S16,<x>,<y>     output as 16bpp sprite; <x> and <y> give
                                pixels per inch in x and y directions
                S32,<x>,<y>     output as 32bpp sprite; <x> and <y> give
                                pixels per inch in x and y directions
                <mode>[c|d|t|r] output as 1/2/4/8bpp sprite, in the given
                                mode number; suffix makes it use:
                        c       1bpp:   clustered dithering with 44 cell
                                2bpp:   black, cyan, magenta and yellow
                        d       1bpp:   clustered dithering with 22 cell
                                4bpp:   1 bit red, 1 bit green, 1 bit blue
                                8bpp:   256 level grey scale
                        t       1bpp:   clustered dithering with 33 cell
                                4bpp:   16 level grey scale
                        r       2bpp:   devious colour matching algorithm
                                4bpp:   devious colour matching algorithm
                                8bpp:   devious colour matching algorithm
                        <none>  1bpp:   b/w dispersed dot dithering
                                2bpp:   4 level grey scale
                                4bpp:   8 level grey scale
                                8bpp:   John Bowler's colour matching
                                        algorithm (defaults to 'r' mode if
                                        not VIDC1 compatible)

<scale>,        amount to scale output by from its default size (the same as
<y scale>       that of the source, after correcting for pixel size):
                <n>:<n>         scale in ratio output size:source size
                <n>:[0]         scale to <n> pixels
                =               scale to fill output mode

<options>       Flags specifying what processing is to be applied to the
                source image:
                -info           give details of the source image
                -hist           don't process the source image, but display
                                a histogram of it instead
                -nosize         disable automatic pixel size correction for
                                source pixels only
                -noscale        disable all automatic pixel size correction
                -lock           lock picture aspect ratio
                -rotate         rotate the image by +90 (ie anti-clockwise)
                -rotate-        rotate the image by -90 (ie clockwise)
                -hflip          horizontally flip the image
                -vflip          vertically flip the image
                -range          expand the source's dynamic range to full
                                scale
                -equal          perform histogram equalisation
                -nodither       disable the error diffusion dithering
                -invert         invert the colour range of the source image
                -brighten       slightly brighten the entire image (caution:
                                this may saturate pale hues to white)
                -black[<n>]     corrects for black inked spots larger than
                                square pixels; <n> is in the range 0 (not at
                                all) to 128 (harsh), and defaults to 32
                -gamma[<n>]     apply gamma correction; <n> overrides the
                                default of 2.2
                -sharpen[<n>]   digitally sharpen the image; <n> is in the
                                range 8 (harsh) to 31 (soft), and defaults
                                to 24
                -smooth[<n>]    digitally smooth the image; <n> is in the
                                range 1 (very smooth) to 23 (hardly
                                smoothed at all), and defaults to 1
                -nomode         don't change to mode 0 while processing the
                                image
                -max<n>         set the maximum size of the output image
                                before it is output to disc
                -red<r>,        change the red, green and blue weights for
                -green<g>,      deriving monochrome luminance from their CIE
                -blue<b>        defaults of 0.299, 0.587 and 0.114

Use
---
You need to have the ChangeFSI program in the library, or on Run$Path, or to
specify its full pathname on the command line; and you must be running
outside the desktop (e.g. by pressing F12).

An hourglass is displayed giving the percentage processed; this may run
through twice for some of the more expensive options. The program reads the
source image from disc and builds the output in memory, having claimed some
from the system.

You can improve ChangeFSI's performance by first typing '*RMFaster BASIC'.

The -nomode option
------------------
The program selects mode 0 when doing any work in order to speed up
processing; you can disable this using -nomode.

The -max option
---------------
You can build very large output files strips at a time and send them
directly to disk using the parameter '-max'. For example:

  ChangeFSI <in> <out> 28 -max512K

will convert the file with a maximum of 512KBytes held in memory. Options 25t,
-rotate and -vflip don't work when this is being done.

The -red, -green and -blue options
----------------------------------
Conversion from colour to monochrome shades of grey is done with the CIE
luminance weights for red, green and blue (0.299, 0.587, 0.114), which is
the standard conversion for broadcast television. These values can be
altered using the -red, -green and -blue options, so you can try different
weightings for conversion to monochrome. This also allows you to separate
out some of the colours in making a black and white image (e.g. -red1
-green0 -blue0).

Other options
-------------
For details of other options, see the DesktopUse file's descriptions of the
equivalent desktop options.

Examples
--------
 Make "standard palette" versions of existing 256 colour images (for
  example the Watford digitiser plus colour board doesn't use the standard
  palette):

  changefsi in out 13p            for a coloured Watford picture

 Convert a colour picture to something you can see on a high resolution
  monochrome monitor:

  changefsi in out 18 -sharpen -info

 Convert a large monochrome picture (from a scanner, say) to something
  which can be seen:

  changefsi in out 20t 1:4 -gamma

 Convert a colour picture to grey scale for the desktop:

  changefsi in out 20

 Change a 512 by 480 image to standard format and aspect ratio:

  changefsi in out 15 640:512 512:480           or:
  changefsi in out = -range

 Change to digital r, g, b:

  changefsi in out 20d -sharpen16

 Convert a picture for printing on a 300dpi laser.

  changefsi in out 18c 300:90 -sharpen


Using ChangeFSI as a BASIC library
==================================

You can also load ChangeFSI as a BASIC function library from other BASIC
programs, thus:

LIBRARY "<ChangeFSI$Dir>.ChangeFSI"

This gives a new function - FNChangeFSI - which provides the full command
line functionality of ChangeFSI. FNChangeFSI takes these arguments:

A$              a command line argument
spritearea%     an address, or -1 for the spritearea built by ChangeFSI
workspace%      an address, or -1 for ChangeFSI's other workspace
worklimit%      an address (unused if workspace%<0)
fast%           TRUE for MODE 0 selection

It produces an error (to whatever error handler is present) if it fails.

It only saves the sprite to the file given in the command string if
spritearea% is <0.


System variables
================

For command line or BASIC library use, the variable ChangeFSI$Dir must be
set to the full pathname of the !ChangeFSI application, or certain
operations may fail.

By default ChangeFSI uses a 128K cache to speed processing. For command line
or BASIC library use, any input JPEG images must fit in the cache. You can
change the size of this cache by setting the variable ChangeFSI$Cache. For
example:

Set ChangeFSI$Cache 256K

You can also set the system variable ChangeFSI$PCDIndex to change the
PhotoCD resolution that is read. The default value is 3, which corresponds
to the base image.
