⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usage.doc

📁 game engine, which is useful for everyone who is interested in it. I hope you can enjoy it.
💻 DOC
📖 第 1 页 / 共 2 页
字号:
USAGE instructions for the Independent JPEG Group's JPEG software
=================================================================

This file describes usage of the JPEG conversion programs cjpeg and djpeg,
as well as the utility programs jpegtran, rdjpgcom and wrjpgcom.  (See
the other documentation files if you wish to use the JPEG library within
your own programs.)

If you are on a Unix machine you may prefer to read the Unix-style manual
pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1.


INTRODUCTION

These programs 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 that 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.


GENERAL USAGE

We provide two programs, cjpeg to compress an image file into JPEG format,
and djpeg to decompress a JPEG file back into a conventional image format.

On Unix-like systems, you say:
	cjpeg [switches] [imagefile] >jpegfile
or
	djpeg [switches] [jpegfile]  >imagefile
The programs read the specified input file, or standard input if none is
named.  They always write to standard output (with trace/error messages to
standard error).  These conventions are handy for piping images between
programs.

On most non-Unix systems, you say:
	cjpeg [switches] imagefile jpegfile
or
	djpeg [switches] jpegfile  imagefile
i.e., both the input and output files are named on the command line.  This
style is a little more foolproof, and it loses no functionality if you don't
have pipes.  (You can get this style on Unix too, if you prefer, by defining
TWO_FILE_COMMANDLINE when you compile the programs; see install.doc.)

You can also say:
	cjpeg [switches] -outfile jpegfile  imagefile
or
	djpeg [switches] -outfile imagefile  jpegfile
This syntax works on all systems, so it is useful for scripts.

The currently supported image file formats are: PPM (PBMPLUS color format),
PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit
format).  (RLE is supported only if the URT library is available.)
cjpeg recognizes the input image format automatically, with the exception
of some Targa-format files.  You have to tell djpeg which format to generate.

JPEG files are in the defacto standard JFIF file format.  There are other,
less widely used JPEG-based file formats, but we don't support them.

All switch names may be abbreviated; for example, -grayscale may be written
-gray or -gr.  Most of the "basic" switches can be abbreviated to as little as
one letter.  Upper and lower case are equivalent (-BMP is the same as -bmp).
British spellings are also accepted (e.g., -greyscale), though for brevity
these are not mentioned below.


CJPEG DETAILS

The basic command line switches for cjpeg are:

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

	-grayscale	Create monochrome JPEG file from color input.
			Be sure to use this switch when compressing a grayscale
			BMP file, because cjpeg isn't bright enough to notice
			whether a BMP file uses only shades of gray.  By
			saying -grayscale, you'll get a smaller JPEG file that
			takes less time to process.

	-optimize	Perform optimization of entropy encoding parameters.
			Without this, default encoding parameters are used.
			-optimize usually makes the JPEG file a little smaller,
			but cjpeg runs somewhat slower and needs much more
			memory.  Image quality and speed of decompression are
			unaffected by -optimize.

	-progressive	Create progressive JPEG file (see below).

	-targa		Input file is Targa format.  Targa files that contain
			an "identification" field will not be automatically
			recognized by cjpeg; for such files you must specify
			-targa to make cjpeg treat the input as Targa format.
			For most Targa files, you won't need this switch.

The -quality switch 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
often 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.)

-quality 100 will generate a quantization table of all 1's, minimizing 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.  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.
cjpeg emits a warning message when you give such a quality value, because some
other JPEG programs may be unable to decode the resulting file.  Use -baseline
if you need to ensure compatibility at low quality values.)

The -progressive switch creates a "progressive JPEG" file.  In this type of
JPEG file, the data is stored in multiple scans of increasing quality.  If the
file is being transmitted over a slow communications link, the decoder can use
the first scan to display a low-quality image very quickly, and can then
improve the display with each subsequent scan.  The final image is exactly
equivalent to a standard JPEG file of the same quality setting, and the total
file size is about the same --- often a little smaller.  CAUTION: progressive
JPEG is not yet widely implemented, so many decoders will be unable to view a
progressive JPEG file at all.

Switches for advanced users:

	-dct int	Use integer DCT method (default).
	-dct fast	Use fast integer DCT (less accurate).
	-dct float	Use floating-point DCT method.
			The float method is very slightly more accurate than
			the int method, but is much slower unless your machine
			has very fast floating-point hardware.  Also note that
			results of the floating-point method may vary slightly
			across machines, while the integer methods should give
			the same results everywhere.  The fast integer method
			is much less accurate than the other two.

	-restart N	Emit a JPEG restart marker every N MCU rows, or every
			N MCU blocks if "B" is attached to the number.
			-restart 0 (the default) means no restart markers.

	-smooth N	Smooth the input image to eliminate dithering noise.
			N, ranging from 1 to 100, indicates the strength of
			smoothing.  0 (the default) means no smoothing.

	-maxmemory N	Set limit for amount of memory to use in processing
			large images.  Value is in thousands of bytes, or
			millions of bytes if "M" is attached to the number.
			For example, -max 4m selects 4000000 bytes.  If more
			space is needed, temporary files will be used.

	-verbose	Enable debug printout.  More -v's give more printout.
	or  -debug	Also, version information is printed at startup.

The -restart option inserts extra markers that allow a JPEG decoder to
resynchronize after a transmission error.  Without restart markers, any damage
to a compressed file will usually ruin the image from the point of the error
to the end of the image; with restart markers, the damage is usually confined
to the portion of the image up to the next restart marker.  Of course, the
restart markers occupy extra space.  We recommend -restart 1 for images that
will be transmitted across unreliable networks such as Usenet.

The -smooth option filters the input to eliminate fine-scale noise.  This is
often useful when converting dithered images to JPEG: a moderate smoothing
factor of 10 to 50 gets rid of dithering patterns in the input file, resulting
in a smaller JPEG file and a better-looking image.  Too large a smoothing
factor will visibly blur the image, however.

Switches for wizards:

	-baseline	Force baseline-compatible quantization tables to be
			generated.  This clamps quantization values to 8 bits
			even at low quality settings.  (This switch is poorly
			named, since it does not ensure that the output is
			actually baseline JPEG.  For example, you can use
			-baseline and -progressive together.)

	-qtables file	Use the quantization tables given in the specified
			text file.

	-qslots N[,...] Select which quantization table to use for each color
			component.

	-sample HxV[,...]  Set JPEG sampling factors for each color component.

	-scans file	Use the scan script given in the specified text file.

The "wizard" switches are intended for experimentation with JPEG.  If you
don't know what you are doing, DON'T USE THEM.  These switches are documented
further in the file wizard.doc.


DJPEG DETAILS

The basic command line switches for djpeg are:

	-colors N	Reduce image to at most N colors.  This reduces the
	or -quantize N	number of colors used in the output image, so that it
			can be displayed on a colormapped display or stored in
			a colormapped file format.  For example, if you have
			an 8-bit display, you'd need to reduce to 256 or fewer
			colors.  (-colors is the recommended name, -quantize
			is provided only for backwards compatibility.)

	-fast		Select recommended processing options for fast, low
			quality output.  (The default options are chosen for
			highest quality output.)  Currently, this is equivalent
			to "-dct fast -nosmooth -onepass -dither ordered".

	-grayscale	Force gray-scale output even if JPEG file is color.
			Useful for viewing on monochrome displays; also,
			djpeg runs noticeably faster in this mode.

	-scale M/N	Scale the output image by a factor M/N.  Currently
			the scale factor must be 1/1, 1/2, 1/4, or 1/8.
			Scaling is handy if the image is larger than your
			screen; also, djpeg runs much faster when scaling
			down the output.

	-bmp		Select BMP output format (Windows flavor).  8-bit
			colormapped format is emitted if -colors or -grayscale
			is specified, or if the JPEG file is gray-scale;
			otherwise, 24-bit full-color format is emitted.

	-gif		Select GIF output format.  Since GIF does not support
			more than 256 colors, -colors 256 is assumed (unless
			you specify a smaller number of colors).  If you
			specify -fast, the default number of colors is 216.

	-os2		Select BMP output format (OS/2 1.x flavor).  8-bit
			colormapped format is emitted if -colors or -grayscale
			is specified, or if the JPEG file is gray-scale;
			otherwise, 24-bit full-color format is emitted.

	-pnm		Select PBMPLUS (PPM/PGM) output format (this is the
			default format).  PGM is emitted if the JPEG file is
			gray-scale or if -grayscale is specified; otherwise
			PPM is emitted.

	-rle		Select RLE output format.  (Requires URT library.)

	-targa		Select Targa output format.  Gray-scale format is
			emitted if the JPEG file is gray-scale or if
			-grayscale is specified; otherwise, colormapped format
			is emitted if -colors is specified; otherwise, 24-bit
			full-color format is emitted.

Switches for advanced users:

	-dct int	Use integer DCT method (default).
	-dct fast	Use fast integer DCT (less accurate).
	-dct float	Use floating-point DCT method.
			The float method is very slightly more accurate than
			the int method, but is much slower unless your machine
			has very fast floating-point hardware.  Also note that
			results of the floating-point method may vary slightly
			across machines, while the integer methods should give
			the same results everywhere.  The fast integer method
			is much less accurate than the other two.

	-dither fs	Use Floyd-Steinberg dithering in color quantization.
	-dither ordered	Use ordered dithering in color quantization.
	-dither none	Do not use dithering in color quantization.
			By default, Floyd-Steinberg dithering is applied when
			quantizing colors; this is slow but usually produces
			the best results.  Ordered dither is a compromise

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -