Blame gtkmm-osx/jpeg-6b/cjpeg.1

darco 56a656
.TH CJPEG 1 "20 March 1998"
darco 56a656
.SH NAME
darco 56a656
cjpeg \- compress an image file to a JPEG file
darco 56a656
.SH SYNOPSIS
darco 56a656
.B cjpeg
darco 56a656
[
darco 56a656
.I options
darco 56a656
]
darco 56a656
[
darco 56a656
.I filename
darco 56a656
]
darco 56a656
.LP
darco 56a656
.SH DESCRIPTION
darco 56a656
.LP
darco 56a656
.B cjpeg
darco 56a656
compresses the named image file, or the standard input if no file is
darco 56a656
named, and produces a JPEG/JFIF file on the standard output.
darco 56a656
The currently supported input file formats are: PPM (PBMPLUS color
darco 56a656
format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster
darco 56a656
Toolkit format).  (RLE is supported only if the URT library is available.)
darco 56a656
.SH OPTIONS
darco 56a656
All switch names may be abbreviated; for example,
darco 56a656
.B \-grayscale
darco 56a656
may be written
darco 56a656
.B \-gray
darco 56a656
or
darco 56a656
.BR \-gr .
darco 56a656
Most of the "basic" switches can be abbreviated to as little as one letter.
darco 56a656
Upper and lower case are equivalent (thus
darco 56a656
.B \-BMP
darco 56a656
is the same as
darco 56a656
.BR \-bmp ).
darco 56a656
British spellings are also accepted (e.g.,
darco 56a656
.BR \-greyscale ),
darco 56a656
though for brevity these are not mentioned below.
darco 56a656
.PP
darco 56a656
The basic switches are:
darco 56a656
.TP
darco 56a656
.BI \-quality " N"
darco 56a656
Scale quantization tables to adjust image quality.  Quality is 0 (worst) to
darco 56a656
100 (best); default is 75.  (See below for more info.)
darco 56a656
.TP
darco 56a656
.B \-grayscale
darco 56a656
Create monochrome JPEG file from color input.  Be sure to use this switch when
darco 56a656
compressing a grayscale BMP file, because
darco 56a656
.B cjpeg
darco 56a656
isn't bright enough to notice whether a BMP file uses only shades of gray.
darco 56a656
By saying
darco 56a656
.BR \-grayscale ,
darco 56a656
you'll get a smaller JPEG file that takes less time to process.
darco 56a656
.TP
darco 56a656
.B \-optimize
darco 56a656
Perform optimization of entropy encoding parameters.  Without this, default
darco 56a656
encoding parameters are used.
darco 56a656
.B \-optimize
darco 56a656
usually makes the JPEG file a little smaller, but
darco 56a656
.B cjpeg
darco 56a656
runs somewhat slower and needs much more memory.  Image quality and speed of
darco 56a656
decompression are unaffected by
darco 56a656
.BR \-optimize .
darco 56a656
.TP
darco 56a656
.B \-progressive
darco 56a656
Create progressive JPEG file (see below).
darco 56a656
.TP
darco 56a656
.B \-targa
darco 56a656
Input file is Targa format.  Targa files that contain an "identification"
darco 56a656
field will not be automatically recognized by
darco 56a656
.BR cjpeg ;
darco 56a656
for such files you must specify
darco 56a656
.B \-targa
darco 56a656
to make
darco 56a656
.B cjpeg
darco 56a656
treat the input as Targa format.
darco 56a656
For most Targa files, you won't need this switch.
darco 56a656
.PP
darco 56a656
The
darco 56a656
.B \-quality
darco 56a656
switch lets you trade off compressed file size against quality of the
darco 56a656
reconstructed image: the higher the quality setting, the larger the JPEG file,
darco 56a656
and the closer the output image will be to the original input.  Normally you
darco 56a656
want to use the lowest quality setting (smallest file) that decompresses into
darco 56a656
something visually indistinguishable from the original image.  For this
darco 56a656
purpose the quality setting should be between 50 and 95; the default of 75 is
darco 56a656
often about right.  If you see defects at
darco 56a656
.B \-quality
darco 56a656
75, then go up 5 or 10 counts at a time until you are happy with the output
darco 56a656
image.  (The optimal setting will vary from one image to another.)
darco 56a656
.PP
darco 56a656
.B \-quality
darco 56a656
100 will generate a quantization table of all 1's, minimizing loss in the
darco 56a656
quantization step (but there is still information loss in subsampling, as well
darco 56a656
as roundoff error).  This setting is mainly of interest for experimental
darco 56a656
purposes.  Quality values above about 95 are
darco 56a656
.B not
darco 56a656
recommended for normal use; the compressed file size goes up dramatically for
darco 56a656
hardly any gain in output image quality.
darco 56a656
.PP
darco 56a656
In the other direction, quality values below 50 will produce very small files
darco 56a656
of low image quality.  Settings around 5 to 10 might be useful in preparing an
darco 56a656
index of a large image library, for example.  Try
darco 56a656
.B \-quality
darco 56a656
2 (or so) for some amusing Cubist effects.  (Note: quality
darco 56a656
values below about 25 generate 2-byte quantization tables, which are
darco 56a656
considered optional in the JPEG standard.
darco 56a656
.B cjpeg
darco 56a656
emits a warning message when you give such a quality value, because some
darco 56a656
other JPEG programs may be unable to decode the resulting file.  Use
darco 56a656
.B \-baseline
darco 56a656
if you need to ensure compatibility at low quality values.)
darco 56a656
.PP
darco 56a656
The
darco 56a656
.B \-progressive
darco 56a656
switch creates a "progressive JPEG" file.  In this type of JPEG file, the data
darco 56a656
is stored in multiple scans of increasing quality.  If the file is being
darco 56a656
transmitted over a slow communications link, the decoder can use the first
darco 56a656
scan to display a low-quality image very quickly, and can then improve the
darco 56a656
display with each subsequent scan.  The final image is exactly equivalent to a
darco 56a656
standard JPEG file of the same quality setting, and the total file size is
darco 56a656
about the same --- often a little smaller.
darco 56a656
.B Caution:
darco 56a656
progressive JPEG is not yet widely implemented, so many decoders will be
darco 56a656
unable to view a progressive JPEG file at all.
darco 56a656
.PP
darco 56a656
Switches for advanced users:
darco 56a656
.TP
darco 56a656
.B \-dct int
darco 56a656
Use integer DCT method (default).
darco 56a656
.TP
darco 56a656
.B \-dct fast
darco 56a656
Use fast integer DCT (less accurate).
darco 56a656
.TP
darco 56a656
.B \-dct float
darco 56a656
Use floating-point DCT method.
darco 56a656
The float method is very slightly more accurate than the int method, but is
darco 56a656
much slower unless your machine has very fast floating-point hardware.  Also
darco 56a656
note that results of the floating-point method may vary slightly across
darco 56a656
machines, while the integer methods should give the same results everywhere.
darco 56a656
The fast integer method is much less accurate than the other two.
darco 56a656
.TP
darco 56a656
.BI \-restart " N"
darco 56a656
Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
darco 56a656
attached to the number.
darco 56a656
.B \-restart 0
darco 56a656
(the default) means no restart markers.
darco 56a656
.TP
darco 56a656
.BI \-smooth " N"
darco 56a656
Smooth the input image to eliminate dithering noise.  N, ranging from 1 to
darco 56a656
100, indicates the strength of smoothing.  0 (the default) means no smoothing.
darco 56a656
.TP
darco 56a656
.BI \-maxmemory " N"
darco 56a656
Set limit for amount of memory to use in processing large images.  Value is
darco 56a656
in thousands of bytes, or millions of bytes if "M" is attached to the
darco 56a656
number.  For example,
darco 56a656
.B \-max 4m
darco 56a656
selects 4000000 bytes.  If more space is needed, temporary files will be used.
darco 56a656
.TP
darco 56a656
.BI \-outfile " name"
darco 56a656
Send output image to the named file, not to standard output.
darco 56a656
.TP
darco 56a656
.B \-verbose
darco 56a656
Enable debug printout.  More
darco 56a656
.BR \-v 's
darco 56a656
give more output.  Also, version information is printed at startup.
darco 56a656
.TP
darco 56a656
.B \-debug
darco 56a656
Same as
darco 56a656
.BR \-verbose .
darco 56a656
.PP
darco 56a656
The
darco 56a656
.B \-restart
darco 56a656
option inserts extra markers that allow a JPEG decoder to resynchronize after
darco 56a656
a transmission error.  Without restart markers, any damage to a compressed
darco 56a656
file will usually ruin the image from the point of the error to the end of the
darco 56a656
image; with restart markers, the damage is usually confined to the portion of
darco 56a656
the image up to the next restart marker.  Of course, the restart markers
darco 56a656
occupy extra space.  We recommend
darco 56a656
.B \-restart 1
darco 56a656
for images that will be transmitted across unreliable networks such as Usenet.
darco 56a656
.PP
darco 56a656
The
darco 56a656
.B \-smooth
darco 56a656
option filters the input to eliminate fine-scale noise.  This is often useful
darco 56a656
when converting dithered images to JPEG: a moderate smoothing factor of 10 to
darco 56a656
50 gets rid of dithering patterns in the input file, resulting in a smaller
darco 56a656
JPEG file and a better-looking image.  Too large a smoothing factor will
darco 56a656
visibly blur the image, however.
darco 56a656
.PP
darco 56a656
Switches for wizards:
darco 56a656
.TP
darco 56a656
.B \-baseline
darco 56a656
Force baseline-compatible quantization tables to be generated.  This clamps
darco 56a656
quantization values to 8 bits even at low quality settings.  (This switch is
darco 56a656
poorly named, since it does not ensure that the output is actually baseline
darco 56a656
JPEG.  For example, you can use
darco 56a656
.B \-baseline
darco 56a656
and
darco 56a656
.B \-progressive
darco 56a656
together.)
darco 56a656
.TP
darco 56a656
.BI \-qtables " file"
darco 56a656
Use the quantization tables given in the specified text file.
darco 56a656
.TP
darco 56a656
.BI \-qslots " N[,...]"
darco 56a656
Select which quantization table to use for each color component.
darco 56a656
.TP
darco 56a656
.BI \-sample " HxV[,...]"
darco 56a656
Set JPEG sampling factors for each color component.
darco 56a656
.TP
darco 56a656
.BI \-scans " file"
darco 56a656
Use the scan script given in the specified text file.
darco 56a656
.PP
darco 56a656
The "wizard" switches are intended for experimentation with JPEG.  If you
darco 56a656
don't know what you are doing, \fBdon't use them\fR.  These switches are
darco 56a656
documented further in the file wizard.doc.
darco 56a656
.SH EXAMPLES
darco 56a656
.LP
darco 56a656
This example compresses the PPM file foo.ppm with a quality factor of
darco 56a656
60 and saves the output as foo.jpg:
darco 56a656
.IP
darco 56a656
.B cjpeg \-quality
darco 56a656
.I 60 foo.ppm
darco 56a656
.B >
darco 56a656
.I foo.jpg
darco 56a656
.SH HINTS
darco 56a656
Color GIF files are not the ideal input for JPEG; JPEG is really intended for
darco 56a656
compressing full-color (24-bit) images.  In particular, don't try to convert
darco 56a656
cartoons, line drawings, and other images that have only a few distinct
darco 56a656
colors.  GIF works great on these, JPEG does not.  If you want to convert a
darco 56a656
GIF to JPEG, you should experiment with
darco 56a656
.BR cjpeg 's
darco 56a656
.B \-quality
darco 56a656
and
darco 56a656
.B \-smooth
darco 56a656
options to get a satisfactory conversion.
darco 56a656
.B \-smooth 10
darco 56a656
or so is often helpful.
darco 56a656
.PP
darco 56a656
Avoid running an image through a series of JPEG compression/decompression
darco 56a656
cycles.  Image quality loss will accumulate; after ten or so cycles the image
darco 56a656
may be noticeably worse than it was after one cycle.  It's best to use a
darco 56a656
lossless format while manipulating an image, then convert to JPEG format when
darco 56a656
you are ready to file the image away.
darco 56a656
.PP
darco 56a656
The
darco 56a656
.B \-optimize
darco 56a656
option to
darco 56a656
.B cjpeg
darco 56a656
is worth using when you are making a "final" version for posting or archiving.
darco 56a656
It's also a win when you are using low quality settings to make very small
darco 56a656
JPEG files; the percentage improvement is often a lot more than it is on
darco 56a656
larger files.  (At present,
darco 56a656
.B \-optimize
darco 56a656
mode is always selected when generating progressive JPEG files.)
darco 56a656
.SH ENVIRONMENT
darco 56a656
.TP
darco 56a656
.B JPEGMEM
darco 56a656
If this environment variable is set, its value is the default memory limit.
darco 56a656
The value is specified as described for the
darco 56a656
.B \-maxmemory
darco 56a656
switch.
darco 56a656
.B JPEGMEM
darco 56a656
overrides the default value specified when the program was compiled, and
darco 56a656
itself is overridden by an explicit
darco 56a656
.BR \-maxmemory .
darco 56a656
.SH SEE ALSO
darco 56a656
.BR djpeg (1),
darco 56a656
.BR jpegtran (1),
darco 56a656
.BR rdjpgcom (1),
darco 56a656
.BR wrjpgcom (1)
darco 56a656
.br
darco 56a656
.BR ppm (5),
darco 56a656
.BR pgm (5)
darco 56a656
.br
darco 56a656
Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
darco 56a656
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
darco 56a656
.SH AUTHOR
darco 56a656
Independent JPEG Group
darco 56a656
.SH BUGS
darco 56a656
Arithmetic coding is not supported for legal reasons.
darco 56a656
.PP
darco 56a656
GIF input files are no longer supported, to avoid the Unisys LZW patent.
darco 56a656
Use a Unisys-licensed program if you need to read a GIF file.  (Conversion
darco 56a656
of GIF files to JPEG is usually a bad idea anyway.)
darco 56a656
.PP
darco 56a656
Not all variants of BMP and Targa file formats are supported.
darco 56a656
.PP
darco 56a656
The
darco 56a656
.B \-targa
darco 56a656
switch is not a bug, it's a feature.  (It would be a bug if the Targa format
darco 56a656
designers had not been clueless.)
darco 56a656
.PP
darco 56a656
Still not as fast as we'd like.