Instructions and recommendations for the use of JPEG compression -
modified by D.R.Oldcorn of Volume 11 Software Development from that
provided with the Independent JPEG Group's source code version 4.


INTRODUCTION

This distribution contains software to implement JPEG image compression and
decompression.  JPEG (pronounced "jay-peg") is a standardized compression
method for full-color and gray-scale images.  JPEG is designed to handle
"real-world" scenes, for example scanned photographs.  Cartoons, line
drawings, and other non-realistic images are not JPEG's strong suit; on this
sort of material you may get poor image quality and/or little compression.

JPEG is lossy, meaning that the output image is not necessarily identical to
the input image.  Hence you should not use JPEG if you have to have identical
output bits.  However, on typical real-world images, very good compression
levels can be obtained with no visible change, and amazingly high compression
is possible if you can tolerate a low-quality image.  You can trade off image
quality against file size by adjusting the compressor's "quality" setting.


COMPRESSION OPTIONS


Quality Factor - Scale quantization tables to adjust image quality.
     Quality is 0 (worst) to 100 (best); default is 75.
    (See below for more info.)

Greyscale - Create monochrome JPEG file from color input. The software
    doesn't know if an image only uses grey shades, so this can be
    used to force a greyscale output.

Optimize - Perform optimization of entropy encoding parameters.
    Without this, default encoding parameters are used. Optimize makes
    the JPEG file a little smaller, but compression is a little slower
    and needs more memory and / or a swapfile.  Image quality and speed
    of decompression are unaffected by optimisation.

Note that although output is onto the 16-bit Truecolour mode of the Falcon,
all calculations are performed at 24-bit resolution. The DSP code is
very very slightly less accurate than the 030 code, equivalent to about
1 part in 768. All output and recompression (Targa/JFIF) is done in
full 24 bit colour.

The quality option lets you trade off compressed file size against quality of
the reconstructed image: the higher the quality setting, the larger the JPEG
file, and the closer the output image will be to the original input.  Normally
you want to use the lowest quality setting (smallest file) that decompresses
into something visually indistinguishable from the original image.  For this
purpose the quality setting should be between 50 and 95; the default of 75 is
usually about right.  If you see defects at quality 75, then go up 5 or 10
counts at a time until you are happy with the output image.  (The optimal
setting will vary from one image to another.)

For 24-bit colour input images, it is rare that quality factors above 75
will be required - filesize increases quite significantly for extremely
small improvements in appearance. An IMPORTANT thing to remember is that
on the Falcon you 1) are viewing images in only 16-bit colour, which may
not necessarily let you see all the low-level artifacts - although these
are unlikely to be too bad - and 2) if you view the image in interlace
modes it eliminates the vast majority of artifacts due to the natural
aliasing effect of interlace, so always check your images using a fixed
non-interlaced mode.

Quality 100 will generate a quantization table of all 1's, eliminating loss
in the quantization step (but there is still information loss in subsampling,
as well as roundoff error).  This setting is mainly of interest for
experimental purposes.  Quality values above about 95 are NOT recommended for
normal use; the compressed file size goes up dramatically for hardly any gain
in output image quality.

In the other direction, quality values below 50 will produce very small files
of low image quality, although depending on the image the quality can still be
acceptable for many purposes even at around 25-30.  Settings around 5 to 10
might be useful in preparing an index of a large image library, for example.
Try -quality 2 (or so) for some amusing Cubist effects.  (Note: quality values
below about 25 generate 2-byte quantization tables, which are considered
optional in the JPEG standard).

Restart markers are not available in this implementation, and sampling
ratios are fixed at 2x2 1x1 1x1.



HINTS

Color GIF files are not the ideal input for JPEG; JPEG is really intended for
compressing full-color (24-bit) images.  In particular, don't try to convert
cartoons, line drawings, and other images that have only a few distinct
colors.  GIF works great on these, JPEG does not. JPEG artifacts and
colour quantisation have BAD effects when mixed together... colourmapped
images will usually be larger and of poorer quality than a 24-bit colour
input.

Avoid running an image through a series of JPEG compression/decompression
cycles.  Image quality loss will accumulate; after ten or so cycles the image
may be noticeably worse than it was after one cycle.  It's best to use a
lossless format while manipulating an image, then convert to JPEG format when
you are ready to file the image away.

The optimize option is worth using when you are making a "final" version
for posting or archiving.  It's also a win when you are using low quality
settings to make very small JPEG files; the percentage improvement is
often a lot more than it is on larger files.

