image_compressor_pack 0.1.3-amd64-freebsd-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.txt +22 -0
- data/lib/.paths.yml +12 -0
- data/lib/image_compressor_pack/dynamically_linked_recipes.yml +99 -0
- data/lib/image_compressor_pack/recipes.rb +42 -0
- data/lib/image_compressor_pack/statically_linked_recipes.yml +106 -0
- data/lib/image_compressor_pack/version.rb +3 -0
- data/lib/image_compressor_pack.rb +24 -0
- data/ports/advancecomp-1.2-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/archives/2.1.1.tar.gz +0 -0
- data/ports/archives/2.7.1.tar.gz +0 -0
- data/ports/archives/advancecomp-1.20.tar.gz +0 -0
- data/ports/archives/gifsicle-1.88.tar.gz +0 -0
- data/ports/archives/jhead-3.00.tar.gz +0 -0
- data/ports/archives/jpegoptim-1.4.3.tar.gz +0 -0
- data/ports/archives/lcms2-2.7.tar.gz +0 -0
- data/ports/archives/libpng-1.6.21.tar.gz +0 -0
- data/ports/archives/mozjpeg-3.1-release-source.tar.gz +0 -0
- data/ports/archives/nasm-2.12.01.tar.gz +0 -0
- data/ports/archives/optipng-0.7.6.tar.gz +0 -0
- data/ports/archives/pngcrush-1.8.1.tar.gz +0 -0
- data/ports/archives/zlib-1.2.8.tar.gz +0 -0
- data/ports/gifsicle-1.88-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/jhead-3.0-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/jpeg-archive-2.1.1-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/jpegoptim-1.4.3-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/lcms2-2.7-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/libpng-1.6.21-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/mozjpeg-3.1-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/nasm-2.12.01-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/optipng-0.7.6-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/pngcrush-1.8.1-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/pngquant-2.7.1-x86_64-unknown-freebsd10.3.installed +0 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/bin/advdef +0 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/bin/advmng +0 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/bin/advpng +0 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/bin/advzip +0 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/share/man/man1/advdef.1 +83 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/share/man/man1/advmng.1 +197 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/share/man/man1/advpng.1 +93 -0
- data/ports/x86_64-unknown-freebsd10.3/advancecomp/1.2/share/man/man1/advzip.1 +116 -0
- data/ports/x86_64-unknown-freebsd10.3/gifsicle/1.88/bin/gifsicle +0 -0
- data/ports/x86_64-unknown-freebsd10.3/gifsicle/1.88/share/man/man1/gifsicle.1 +1318 -0
- data/ports/x86_64-unknown-freebsd10.3/jhead/3.0/bin/jhead +0 -0
- data/ports/x86_64-unknown-freebsd10.3/jpeg-archive/2.1.1/bin/jpeg-archive +40 -0
- data/ports/x86_64-unknown-freebsd10.3/jpeg-archive/2.1.1/bin/jpeg-compare +0 -0
- data/ports/x86_64-unknown-freebsd10.3/jpeg-archive/2.1.1/bin/jpeg-hash +0 -0
- data/ports/x86_64-unknown-freebsd10.3/jpeg-archive/2.1.1/bin/jpeg-recompress +0 -0
- data/ports/x86_64-unknown-freebsd10.3/jpegoptim/1.4.3/bin/jpegoptim +0 -0
- data/ports/x86_64-unknown-freebsd10.3/jpegoptim/1.4.3/share/man/man1/jpegoptim.1 +186 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/bin/linkicc +0 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/bin/psicc +0 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/bin/transicc +0 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/include/lcms2.h +1889 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/include/lcms2_plugin.h +637 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/lib/liblcms2.a +0 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/lib/liblcms2.la +41 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/lib/pkgconfig/lcms2.pc +11 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/share/man/man1/jpgicc.1 +122 -0
- data/ports/x86_64-unknown-freebsd10.3/lcms2/2.7/share/man/man1/tificc.1 +117 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/include/libpng16/png.h +3130 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/include/libpng16/pngconf.h +622 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/include/libpng16/pnglibconf.h +212 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/include/png.h +1 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/include/pngconf.h +1 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/include/pnglibconf.h +1 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/lib/libpng.a +1 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/lib/libpng.la +1 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/lib/libpng16.a +0 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/lib/libpng16.la +41 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/lib/pkgconfig/libpng16.pc +11 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/share/man/man3/libpng.3 +6124 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/share/man/man3/libpngpf.3 +18 -0
- data/ports/x86_64-unknown-freebsd10.3/libpng/1.6.21/share/man/man5/png.5 +74 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/bin/cjpeg +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/bin/djpeg +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/bin/jpegtran +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/bin/rdjpgcom +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/bin/tjbench +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/bin/wrjpgcom +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/include/jconfig.h +71 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/include/jerror.h +320 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/include/jmorecfg.h +390 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/include/jpeglib.h +1185 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/include/turbojpeg.h +1538 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/lib/libjpeg.a +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/lib/libjpeg.la +41 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/lib/libturbojpeg.a +0 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/lib/libturbojpeg.la +41 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/README +281 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/README-mozilla.txt +194 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/README-turbo.txt +363 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/example.c +433 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/libjpeg.txt +3015 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/structure.txt +906 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/usage.txt +649 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/doc/wizard.txt +211 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/man/man1/cjpeg.1 +352 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/man/man1/djpeg.1 +278 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/man/man1/jpegtran.1 +269 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/man/man1/rdjpgcom.1 +63 -0
- data/ports/x86_64-unknown-freebsd10.3/mozjpeg/3.1/share/man/man1/wrjpgcom.1 +103 -0
- data/ports/x86_64-unknown-freebsd10.3/nasm/2.12.01/bin/nasm +0 -0
- data/ports/x86_64-unknown-freebsd10.3/nasm/2.12.01/bin/ndisasm +0 -0
- data/ports/x86_64-unknown-freebsd10.3/nasm/2.12.01/share/man/man1/nasm.1 +429 -0
- data/ports/x86_64-unknown-freebsd10.3/nasm/2.12.01/share/man/man1/ndisasm.1 +120 -0
- data/ports/x86_64-unknown-freebsd10.3/optipng/0.7.6/bin/optipng +0 -0
- data/ports/x86_64-unknown-freebsd10.3/optipng/0.7.6/man/man1/optipng.1 +343 -0
- data/ports/x86_64-unknown-freebsd10.3/pngcrush/1.8.1/bin/pngcrush +0 -0
- data/ports/x86_64-unknown-freebsd10.3/pngquant/2.7.1/bin/pngquant +0 -0
- data/ports/x86_64-unknown-freebsd10.3/pngquant/2.7.1/share/man/man1/pngquant.1 +127 -0
- data/ports/x86_64-unknown-freebsd10.3/zlib/1.2.8/include/zconf.h +511 -0
- data/ports/x86_64-unknown-freebsd10.3/zlib/1.2.8/include/zlib.h +1768 -0
- data/ports/x86_64-unknown-freebsd10.3/zlib/1.2.8/lib/libz.a +0 -0
- data/ports/x86_64-unknown-freebsd10.3/zlib/1.2.8/lib/pkgconfig/zlib.pc +13 -0
- data/ports/x86_64-unknown-freebsd10.3/zlib/1.2.8/share/man/man3/zlib.3 +151 -0
- data/ports/zlib-1.2.8-x86_64-unknown-freebsd10.3.installed +0 -0
- data.tar.gz.sig +0 -0
- metadata +264 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,211 @@
|
|
1
|
+
Advanced usage instructions for the Independent JPEG Group's JPEG software
|
2
|
+
==========================================================================
|
3
|
+
|
4
|
+
This file describes cjpeg's "switches for wizards".
|
5
|
+
|
6
|
+
The "wizard" switches are intended for experimentation with JPEG by persons
|
7
|
+
who are reasonably knowledgeable about the JPEG standard. If you don't know
|
8
|
+
what you are doing, DON'T USE THESE SWITCHES. You'll likely produce files
|
9
|
+
with worse image quality and/or poorer compression than you'd get from the
|
10
|
+
default settings. Furthermore, these switches must be used with caution
|
11
|
+
when making files intended for general use, because not all JPEG decoders
|
12
|
+
will support unusual JPEG parameter settings.
|
13
|
+
|
14
|
+
|
15
|
+
Quantization Table Adjustment
|
16
|
+
-----------------------------
|
17
|
+
|
18
|
+
Ordinarily, cjpeg starts with a default set of tables (the same ones given
|
19
|
+
as examples in the JPEG standard) and scales them up or down according to
|
20
|
+
the -quality setting. The details of the scaling algorithm can be found in
|
21
|
+
jcparam.c. At very low quality settings, some quantization table entries
|
22
|
+
can get scaled up to values exceeding 255. Although 2-byte quantization
|
23
|
+
values are supported by the IJG software, this feature is not in baseline
|
24
|
+
JPEG and is not supported by all implementations. If you need to ensure
|
25
|
+
wide compatibility of low-quality files, you can constrain the scaled
|
26
|
+
quantization values to no more than 255 by giving the -baseline switch.
|
27
|
+
Note that use of -baseline will result in poorer quality for the same file
|
28
|
+
size, since more bits than necessary are expended on higher AC coefficients.
|
29
|
+
|
30
|
+
You can substitute a different set of quantization values by using the
|
31
|
+
-qtables switch:
|
32
|
+
|
33
|
+
-qtables file Use the quantization tables given in the named file.
|
34
|
+
|
35
|
+
The specified file should be a text file containing decimal quantization
|
36
|
+
values. The file should contain one to four tables, each of 64 elements.
|
37
|
+
The tables are implicitly numbered 0,1,etc. in order of appearance. Table
|
38
|
+
entries appear in normal array order (NOT in the zigzag order in which they
|
39
|
+
will be stored in the JPEG file).
|
40
|
+
|
41
|
+
Quantization table files are free format, in that arbitrary whitespace can
|
42
|
+
appear between numbers. Also, comments can be included: a comment starts
|
43
|
+
with '#' and extends to the end of the line. Here is an example file that
|
44
|
+
duplicates the default quantization tables:
|
45
|
+
|
46
|
+
# Quantization tables given in JPEG spec, section K.1
|
47
|
+
|
48
|
+
# This is table 0 (the luminance table):
|
49
|
+
16 11 10 16 24 40 51 61
|
50
|
+
12 12 14 19 26 58 60 55
|
51
|
+
14 13 16 24 40 57 69 56
|
52
|
+
14 17 22 29 51 87 80 62
|
53
|
+
18 22 37 56 68 109 103 77
|
54
|
+
24 35 55 64 81 104 113 92
|
55
|
+
49 64 78 87 103 121 120 101
|
56
|
+
72 92 95 98 112 100 103 99
|
57
|
+
|
58
|
+
# This is table 1 (the chrominance table):
|
59
|
+
17 18 24 47 99 99 99 99
|
60
|
+
18 21 26 66 99 99 99 99
|
61
|
+
24 26 56 99 99 99 99 99
|
62
|
+
47 66 99 99 99 99 99 99
|
63
|
+
99 99 99 99 99 99 99 99
|
64
|
+
99 99 99 99 99 99 99 99
|
65
|
+
99 99 99 99 99 99 99 99
|
66
|
+
99 99 99 99 99 99 99 99
|
67
|
+
|
68
|
+
If the -qtables switch is used without -quality, then the specified tables
|
69
|
+
are used exactly as-is. If both -qtables and -quality are used, then the
|
70
|
+
tables taken from the file are scaled in the same fashion that the default
|
71
|
+
tables would be scaled for that quality setting. If -baseline appears, then
|
72
|
+
the quantization values are constrained to the range 1-255.
|
73
|
+
|
74
|
+
By default, cjpeg will use quantization table 0 for luminance components and
|
75
|
+
table 1 for chrominance components. To override this choice, use the -qslots
|
76
|
+
switch:
|
77
|
+
|
78
|
+
-qslots N[,...] Select which quantization table to use for
|
79
|
+
each color component.
|
80
|
+
|
81
|
+
The -qslots switch specifies a quantization table number for each color
|
82
|
+
component, in the order in which the components appear in the JPEG SOF marker.
|
83
|
+
For example, to create a separate table for each of Y,Cb,Cr, you could
|
84
|
+
provide a -qtables file that defines three quantization tables and say
|
85
|
+
"-qslots 0,1,2". If -qslots gives fewer table numbers than there are color
|
86
|
+
components, then the last table number is repeated as necessary.
|
87
|
+
|
88
|
+
|
89
|
+
Sampling Factor Adjustment
|
90
|
+
--------------------------
|
91
|
+
|
92
|
+
By default, cjpeg uses 2:1 horizontal and vertical downsampling when
|
93
|
+
compressing YCbCr data, and no downsampling for all other color spaces.
|
94
|
+
You can override this default with the -sample switch:
|
95
|
+
|
96
|
+
-sample HxV[,...] Set JPEG sampling factors for each color
|
97
|
+
component.
|
98
|
+
|
99
|
+
The -sample switch specifies the JPEG sampling factors for each color
|
100
|
+
component, in the order in which they appear in the JPEG SOF marker.
|
101
|
+
If you specify fewer HxV pairs than there are components, the remaining
|
102
|
+
components are set to 1x1 sampling. For example, the default YCbCr setting
|
103
|
+
is equivalent to "-sample 2x2,1x1,1x1", which can be abbreviated to
|
104
|
+
"-sample 2x2".
|
105
|
+
|
106
|
+
There are still some JPEG decoders in existence that support only 2x1
|
107
|
+
sampling (also called 4:2:2 sampling). Compatibility with such decoders can
|
108
|
+
be achieved by specifying "-sample 2x1". This is not recommended unless
|
109
|
+
really necessary, since it increases file size and encoding/decoding time
|
110
|
+
with very little quality gain.
|
111
|
+
|
112
|
+
|
113
|
+
Multiple Scan / Progression Control
|
114
|
+
-----------------------------------
|
115
|
+
|
116
|
+
By default, cjpeg emits a single-scan sequential JPEG file. The
|
117
|
+
-progressive switch generates a progressive JPEG file using a default series
|
118
|
+
of progression parameters. You can create multiple-scan sequential JPEG
|
119
|
+
files or progressive JPEG files with custom progression parameters by using
|
120
|
+
the -scans switch:
|
121
|
+
|
122
|
+
-scans file Use the scan sequence given in the named file.
|
123
|
+
|
124
|
+
The specified file should be a text file containing a "scan script".
|
125
|
+
The script specifies the contents and ordering of the scans to be emitted.
|
126
|
+
Each entry in the script defines one scan. A scan definition specifies
|
127
|
+
the components to be included in the scan, and for progressive JPEG it also
|
128
|
+
specifies the progression parameters Ss,Se,Ah,Al for the scan. Scan
|
129
|
+
definitions are separated by semicolons (';'). A semicolon after the last
|
130
|
+
scan definition is optional.
|
131
|
+
|
132
|
+
Each scan definition contains one to four component indexes, optionally
|
133
|
+
followed by a colon (':') and the four progressive-JPEG parameters. The
|
134
|
+
component indexes denote which color component(s) are to be transmitted in
|
135
|
+
the scan. Components are numbered in the order in which they appear in the
|
136
|
+
JPEG SOF marker, with the first component being numbered 0. (Note that these
|
137
|
+
indexes are not the "component ID" codes assigned to the components, just
|
138
|
+
positional indexes.)
|
139
|
+
|
140
|
+
The progression parameters for each scan are:
|
141
|
+
Ss Zigzag index of first coefficient included in scan
|
142
|
+
Se Zigzag index of last coefficient included in scan
|
143
|
+
Ah Zero for first scan of a coefficient, else Al of prior scan
|
144
|
+
Al Successive approximation low bit position for scan
|
145
|
+
If the progression parameters are omitted, the values 0,63,0,0 are used,
|
146
|
+
producing a sequential JPEG file. cjpeg automatically determines whether
|
147
|
+
the script represents a progressive or sequential file, by observing whether
|
148
|
+
Ss and Se values other than 0 and 63 appear. (The -progressive switch is
|
149
|
+
not needed to specify this; in fact, it is ignored when -scans appears.)
|
150
|
+
The scan script must meet the JPEG restrictions on progression sequences.
|
151
|
+
(cjpeg checks that the spec's requirements are obeyed.)
|
152
|
+
|
153
|
+
Scan script files are free format, in that arbitrary whitespace can appear
|
154
|
+
between numbers and around punctuation. Also, comments can be included: a
|
155
|
+
comment starts with '#' and extends to the end of the line. For additional
|
156
|
+
legibility, commas or dashes can be placed between values. (Actually, any
|
157
|
+
single punctuation character other than ':' or ';' can be inserted.) For
|
158
|
+
example, the following two scan definitions are equivalent:
|
159
|
+
0 1 2: 0 63 0 0;
|
160
|
+
0,1,2 : 0-63, 0,0 ;
|
161
|
+
|
162
|
+
Here is an example of a scan script that generates a partially interleaved
|
163
|
+
sequential JPEG file:
|
164
|
+
|
165
|
+
0; # Y only in first scan
|
166
|
+
1 2; # Cb and Cr in second scan
|
167
|
+
|
168
|
+
Here is an example of a progressive scan script using only spectral selection
|
169
|
+
(no successive approximation):
|
170
|
+
|
171
|
+
# Interleaved DC scan for Y,Cb,Cr:
|
172
|
+
0,1,2: 0-0, 0, 0 ;
|
173
|
+
# AC scans:
|
174
|
+
0: 1-2, 0, 0 ; # First two Y AC coefficients
|
175
|
+
0: 3-5, 0, 0 ; # Three more
|
176
|
+
1: 1-63, 0, 0 ; # All AC coefficients for Cb
|
177
|
+
2: 1-63, 0, 0 ; # All AC coefficients for Cr
|
178
|
+
0: 6-9, 0, 0 ; # More Y coefficients
|
179
|
+
0: 10-63, 0, 0 ; # Remaining Y coefficients
|
180
|
+
|
181
|
+
Here is an example of a successive-approximation script. This is equivalent
|
182
|
+
to the default script used by "cjpeg -progressive" for YCbCr images:
|
183
|
+
|
184
|
+
# Initial DC scan for Y,Cb,Cr (lowest bit not sent)
|
185
|
+
0,1,2: 0-0, 0, 1 ;
|
186
|
+
# First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits:
|
187
|
+
0: 1-5, 0, 2 ;
|
188
|
+
# Send all Cr,Cb AC coefficients, minus lowest bit:
|
189
|
+
# (chroma data is usually too small to be worth subdividing further;
|
190
|
+
# but note we send Cr first since eye is least sensitive to Cb)
|
191
|
+
2: 1-63, 0, 1 ;
|
192
|
+
1: 1-63, 0, 1 ;
|
193
|
+
# Send remaining Y AC coefficients, minus 2 lowest bits:
|
194
|
+
0: 6-63, 0, 2 ;
|
195
|
+
# Send next-to-lowest bit of all Y AC coefficients:
|
196
|
+
0: 1-63, 2, 1 ;
|
197
|
+
# At this point we've sent all but the lowest bit of all coefficients.
|
198
|
+
# Send lowest bit of DC coefficients
|
199
|
+
0,1,2: 0-0, 1, 0 ;
|
200
|
+
# Send lowest bit of AC coefficients
|
201
|
+
2: 1-63, 1, 0 ;
|
202
|
+
1: 1-63, 1, 0 ;
|
203
|
+
# Y AC lowest bit scan is last; it's usually the largest scan
|
204
|
+
0: 1-63, 1, 0 ;
|
205
|
+
|
206
|
+
It may be worth pointing out that this script is tuned for quality settings
|
207
|
+
of around 50 to 75. For lower quality settings, you'd probably want to use
|
208
|
+
a script with fewer stages of successive approximation (otherwise the
|
209
|
+
initial scans will be really bad). For higher quality settings, you might
|
210
|
+
want to use more stages of successive approximation (so that the initial
|
211
|
+
scans are not too large).
|
@@ -0,0 +1,352 @@
|
|
1
|
+
.TH CJPEG 1 "21 November 2014"
|
2
|
+
.SH NAME
|
3
|
+
cjpeg \- compress an image file to a JPEG file
|
4
|
+
.SH SYNOPSIS
|
5
|
+
.B cjpeg
|
6
|
+
[
|
7
|
+
.I options
|
8
|
+
]
|
9
|
+
[
|
10
|
+
.I filename
|
11
|
+
]
|
12
|
+
.LP
|
13
|
+
.SH DESCRIPTION
|
14
|
+
.LP
|
15
|
+
.B cjpeg
|
16
|
+
compresses the named image file, or the standard input if no file is
|
17
|
+
named, and produces a JPEG/JFIF file on the standard output.
|
18
|
+
The currently supported input file formats are: PPM (PBMPLUS color
|
19
|
+
format), PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster
|
20
|
+
Toolkit format). (RLE is supported only if the URT library is available.)
|
21
|
+
.SH OPTIONS
|
22
|
+
All switch names may be abbreviated; for example,
|
23
|
+
.B \-grayscale
|
24
|
+
may be written
|
25
|
+
.B \-gray
|
26
|
+
or
|
27
|
+
.BR \-gr .
|
28
|
+
Most of the "basic" switches can be abbreviated to as little as one letter.
|
29
|
+
Upper and lower case are equivalent (thus
|
30
|
+
.B \-BMP
|
31
|
+
is the same as
|
32
|
+
.BR \-bmp ).
|
33
|
+
British spellings are also accepted (e.g.,
|
34
|
+
.BR \-greyscale ),
|
35
|
+
though for brevity these are not mentioned below.
|
36
|
+
.PP
|
37
|
+
The basic switches are:
|
38
|
+
.TP
|
39
|
+
.BI \-quality " N[,...]"
|
40
|
+
Scale quantization tables to adjust image quality. Quality is 0 (worst) to
|
41
|
+
100 (best); default is 75. (See below for more info.)
|
42
|
+
.TP
|
43
|
+
.B \-grayscale
|
44
|
+
Create monochrome JPEG file from color input. Be sure to use this switch when
|
45
|
+
compressing a grayscale BMP file, because
|
46
|
+
.B cjpeg
|
47
|
+
isn't bright enough to notice whether a BMP file uses only shades of gray.
|
48
|
+
By saying
|
49
|
+
.BR \-grayscale ,
|
50
|
+
you'll get a smaller JPEG file that takes less time to process.
|
51
|
+
.TP
|
52
|
+
.B \-rgb
|
53
|
+
Create RGB JPEG file.
|
54
|
+
Using this switch suppresses the conversion from RGB
|
55
|
+
colorspace input to the default YCbCr JPEG colorspace.
|
56
|
+
.TP
|
57
|
+
.B \-optimize
|
58
|
+
Perform optimization of entropy encoding parameters. Without this, default
|
59
|
+
encoding parameters are used.
|
60
|
+
.B \-optimize
|
61
|
+
usually makes the JPEG file a little smaller, but
|
62
|
+
.B cjpeg
|
63
|
+
runs somewhat slower and needs much more memory. Image quality and speed of
|
64
|
+
decompression are unaffected by
|
65
|
+
.BR \-optimize .
|
66
|
+
.TP
|
67
|
+
.B \-progressive
|
68
|
+
Create progressive JPEG file (see below).
|
69
|
+
.TP
|
70
|
+
.B \-targa
|
71
|
+
Input file is Targa format. Targa files that contain an "identification"
|
72
|
+
field will not be automatically recognized by
|
73
|
+
.BR cjpeg ;
|
74
|
+
for such files you must specify
|
75
|
+
.B \-targa
|
76
|
+
to make
|
77
|
+
.B cjpeg
|
78
|
+
treat the input as Targa format.
|
79
|
+
For most Targa files, you won't need this switch.
|
80
|
+
.PP
|
81
|
+
The
|
82
|
+
.B \-quality
|
83
|
+
switch lets you trade off compressed file size against quality of the
|
84
|
+
reconstructed image: the higher the quality setting, the larger the JPEG file,
|
85
|
+
and the closer the output image will be to the original input. Normally you
|
86
|
+
want to use the lowest quality setting (smallest file) that decompresses into
|
87
|
+
something visually indistinguishable from the original image. For this
|
88
|
+
purpose the quality setting should be between 50 and 95; the default of 75 is
|
89
|
+
often about right. If you see defects at
|
90
|
+
.B \-quality
|
91
|
+
75, then go up 5 or 10 counts at a time until you are happy with the output
|
92
|
+
image. (The optimal setting will vary from one image to another.)
|
93
|
+
.PP
|
94
|
+
.B \-quality
|
95
|
+
100 will generate a quantization table of all 1's, minimizing loss in the
|
96
|
+
quantization step (but there is still information loss in subsampling, as well
|
97
|
+
as roundoff error). This setting is mainly of interest for experimental
|
98
|
+
purposes. Quality values above about 95 are
|
99
|
+
.B not
|
100
|
+
recommended for normal use; the compressed file size goes up dramatically for
|
101
|
+
hardly any gain in output image quality.
|
102
|
+
.PP
|
103
|
+
In the other direction, quality values below 50 will produce very small files
|
104
|
+
of low image quality. Settings around 5 to 10 might be useful in preparing an
|
105
|
+
index of a large image library, for example. Try
|
106
|
+
.B \-quality
|
107
|
+
2 (or so) for some amusing Cubist effects. (Note: quality
|
108
|
+
values below about 25 generate 2-byte quantization tables, which are
|
109
|
+
considered optional in the JPEG standard.
|
110
|
+
.B cjpeg
|
111
|
+
emits a warning message when you give such a quality value, because some
|
112
|
+
other JPEG programs may be unable to decode the resulting file. Use
|
113
|
+
.B \-baseline
|
114
|
+
if you need to ensure compatibility at low quality values.)
|
115
|
+
.PP
|
116
|
+
The \fB-quality\fR option has been extended in this version of \fBcjpeg\fR to
|
117
|
+
support separate quality settings for luminance and chrominance (or, in
|
118
|
+
general, separate settings for every quantization table slot.) The principle
|
119
|
+
is the same as chrominance subsampling: since the human eye is more sensitive
|
120
|
+
to spatial changes in brightness than spatial changes in color, the chrominance
|
121
|
+
components can be quantized more than the luminance components without
|
122
|
+
incurring any visible image quality loss. However, unlike subsampling, this
|
123
|
+
feature reduces data in the frequency domain instead of the spatial domain,
|
124
|
+
which allows for more fine-grained control. This option is useful in
|
125
|
+
quality-sensitive applications, for which the artifacts generated by
|
126
|
+
subsampling may be unacceptable.
|
127
|
+
.PP
|
128
|
+
The \fB-quality\fR option accepts a comma-separated list of parameters, which
|
129
|
+
respectively refer to the quality levels that should be assigned to the
|
130
|
+
quantization table slots. If there are more q-table slots than parameters,
|
131
|
+
then the last parameter is replicated. Thus, if only one quality parameter is
|
132
|
+
given, this is used for both luminance and chrominance (slots 0 and 1,
|
133
|
+
respectively), preserving the legacy behavior of cjpeg v6b and prior.
|
134
|
+
More (or customized) quantization tables can be set with the \fB-qtables\fR
|
135
|
+
option and assigned to components with the \fB-qslots\fR option (see the
|
136
|
+
"wizard" switches below.)
|
137
|
+
.PP
|
138
|
+
JPEG files generated with separate luminance and chrominance quality are fully
|
139
|
+
compliant with standard JPEG decoders.
|
140
|
+
.PP
|
141
|
+
.BR CAUTION:
|
142
|
+
For this setting to be useful, be sure to pass an argument of \fB-sample 1x1\fR
|
143
|
+
to \fBcjpeg\fR to disable chrominance subsampling. Otherwise, the default
|
144
|
+
subsampling level (2x2, AKA "4:2:0") will be used.
|
145
|
+
.PP
|
146
|
+
The
|
147
|
+
.B \-progressive
|
148
|
+
switch creates a "progressive JPEG" file. In this type of JPEG file, the data
|
149
|
+
is stored in multiple scans of increasing quality. If the file is being
|
150
|
+
transmitted over a slow communications link, the decoder can use the first
|
151
|
+
scan to display a low-quality image very quickly, and can then improve the
|
152
|
+
display with each subsequent scan. The final image is exactly equivalent to a
|
153
|
+
standard JPEG file of the same quality setting, and the total file size is
|
154
|
+
about the same --- often a little smaller.
|
155
|
+
.PP
|
156
|
+
Switches for advanced users:
|
157
|
+
.TP
|
158
|
+
.B \-arithmetic
|
159
|
+
Use arithmetic coding.
|
160
|
+
.B Caution:
|
161
|
+
arithmetic coded JPEG is not yet widely implemented, so many decoders will be
|
162
|
+
unable to view an arithmetic coded JPEG file at all.
|
163
|
+
.TP
|
164
|
+
.B \-dct int
|
165
|
+
Use integer DCT method (default).
|
166
|
+
.TP
|
167
|
+
.B \-dct fast
|
168
|
+
Use fast integer DCT (less accurate).
|
169
|
+
In libjpeg-turbo, the fast method is generally about 5-15% faster than the int
|
170
|
+
method when using the x86/x86-64 SIMD extensions (results may vary with other
|
171
|
+
SIMD implementations, or when using libjpeg-turbo without SIMD extensions.)
|
172
|
+
For quality levels of 90 and below, there should be little or no perceptible
|
173
|
+
difference between the two algorithms. For quality levels above 90, however,
|
174
|
+
the difference between the fast and the int methods becomes more pronounced.
|
175
|
+
With quality=97, for instance, the fast method incurs generally about a 1-3 dB
|
176
|
+
loss (in PSNR) relative to the int method, but this can be larger for some
|
177
|
+
images. Do not use the fast method with quality levels above 97. The
|
178
|
+
algorithm often degenerates at quality=98 and above and can actually produce a
|
179
|
+
more lossy image than if lower quality levels had been used. Also, in
|
180
|
+
libjpeg-turbo, the fast method is not fully accelerated for quality levels
|
181
|
+
above 97, so it will be slower than the int method.
|
182
|
+
.TP
|
183
|
+
.B \-dct float
|
184
|
+
Use floating-point DCT method.
|
185
|
+
The float method is mainly a legacy feature. It does not produce significantly
|
186
|
+
more accurate results than the int method, and it is much slower. The float
|
187
|
+
method may also give different results on different machines due to varying
|
188
|
+
roundoff behavior, whereas the integer methods should give the same results on
|
189
|
+
all machines.
|
190
|
+
.TP
|
191
|
+
.BI \-restart " N"
|
192
|
+
Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
|
193
|
+
attached to the number.
|
194
|
+
.B \-restart 0
|
195
|
+
(the default) means no restart markers.
|
196
|
+
.TP
|
197
|
+
.BI \-smooth " N"
|
198
|
+
Smooth the input image to eliminate dithering noise. N, ranging from 1 to
|
199
|
+
100, indicates the strength of smoothing. 0 (the default) means no smoothing.
|
200
|
+
.TP
|
201
|
+
.BI \-maxmemory " N"
|
202
|
+
Set limit for amount of memory to use in processing large images. Value is
|
203
|
+
in thousands of bytes, or millions of bytes if "M" is attached to the
|
204
|
+
number. For example,
|
205
|
+
.B \-max 4m
|
206
|
+
selects 4000000 bytes. If more space is needed, temporary files will be used.
|
207
|
+
.TP
|
208
|
+
.BI \-outfile " name"
|
209
|
+
Send output image to the named file, not to standard output.
|
210
|
+
.TP
|
211
|
+
.BI \-memdst
|
212
|
+
Compress to memory instead of a file. This feature was implemented mainly as a
|
213
|
+
way of testing the in-memory destination manager (jpeg_mem_dest()), but it is
|
214
|
+
also useful for benchmarking, since it reduces the I/O overhead.
|
215
|
+
.TP
|
216
|
+
.B \-verbose
|
217
|
+
Enable debug printout. More
|
218
|
+
.BR \-v 's
|
219
|
+
give more output. Also, version information is printed at startup.
|
220
|
+
.TP
|
221
|
+
.B \-debug
|
222
|
+
Same as
|
223
|
+
.BR \-verbose .
|
224
|
+
.TP
|
225
|
+
.B \-version
|
226
|
+
Print version information and exit.
|
227
|
+
.PP
|
228
|
+
The
|
229
|
+
.B \-restart
|
230
|
+
option inserts extra markers that allow a JPEG decoder to resynchronize after
|
231
|
+
a transmission error. Without restart markers, any damage to a compressed
|
232
|
+
file will usually ruin the image from the point of the error to the end of the
|
233
|
+
image; with restart markers, the damage is usually confined to the portion of
|
234
|
+
the image up to the next restart marker. Of course, the restart markers
|
235
|
+
occupy extra space. We recommend
|
236
|
+
.B \-restart 1
|
237
|
+
for images that will be transmitted across unreliable networks such as Usenet.
|
238
|
+
.PP
|
239
|
+
The
|
240
|
+
.B \-smooth
|
241
|
+
option filters the input to eliminate fine-scale noise. This is often useful
|
242
|
+
when converting dithered images to JPEG: a moderate smoothing factor of 10 to
|
243
|
+
50 gets rid of dithering patterns in the input file, resulting in a smaller
|
244
|
+
JPEG file and a better-looking image. Too large a smoothing factor will
|
245
|
+
visibly blur the image, however.
|
246
|
+
.PP
|
247
|
+
Switches for wizards:
|
248
|
+
.TP
|
249
|
+
.B \-baseline
|
250
|
+
Force baseline-compatible quantization tables to be generated. This clamps
|
251
|
+
quantization values to 8 bits even at low quality settings. (This switch is
|
252
|
+
poorly named, since it does not ensure that the output is actually baseline
|
253
|
+
JPEG. For example, you can use
|
254
|
+
.B \-baseline
|
255
|
+
and
|
256
|
+
.B \-progressive
|
257
|
+
together.)
|
258
|
+
.TP
|
259
|
+
.BI \-qtables " file"
|
260
|
+
Use the quantization tables given in the specified text file.
|
261
|
+
.TP
|
262
|
+
.BI \-qslots " N[,...]"
|
263
|
+
Select which quantization table to use for each color component.
|
264
|
+
.TP
|
265
|
+
.BI \-sample " HxV[,...]"
|
266
|
+
Set JPEG sampling factors for each color component.
|
267
|
+
.TP
|
268
|
+
.BI \-scans " file"
|
269
|
+
Use the scan script given in the specified text file.
|
270
|
+
.PP
|
271
|
+
The "wizard" switches are intended for experimentation with JPEG. If you
|
272
|
+
don't know what you are doing, \fBdon't use them\fR. These switches are
|
273
|
+
documented further in the file wizard.txt.
|
274
|
+
.SH EXAMPLES
|
275
|
+
.LP
|
276
|
+
This example compresses the PPM file foo.ppm with a quality factor of
|
277
|
+
60 and saves the output as foo.jpg:
|
278
|
+
.IP
|
279
|
+
.B cjpeg \-quality
|
280
|
+
.I 60 foo.ppm
|
281
|
+
.B >
|
282
|
+
.I foo.jpg
|
283
|
+
.SH HINTS
|
284
|
+
Color GIF files are not the ideal input for JPEG; JPEG is really intended for
|
285
|
+
compressing full-color (24-bit) images. In particular, don't try to convert
|
286
|
+
cartoons, line drawings, and other images that have only a few distinct
|
287
|
+
colors. GIF works great on these, JPEG does not. If you want to convert a
|
288
|
+
GIF to JPEG, you should experiment with
|
289
|
+
.BR cjpeg 's
|
290
|
+
.B \-quality
|
291
|
+
and
|
292
|
+
.B \-smooth
|
293
|
+
options to get a satisfactory conversion.
|
294
|
+
.B \-smooth 10
|
295
|
+
or so is often helpful.
|
296
|
+
.PP
|
297
|
+
Avoid running an image through a series of JPEG compression/decompression
|
298
|
+
cycles. Image quality loss will accumulate; after ten or so cycles the image
|
299
|
+
may be noticeably worse than it was after one cycle. It's best to use a
|
300
|
+
lossless format while manipulating an image, then convert to JPEG format when
|
301
|
+
you are ready to file the image away.
|
302
|
+
.PP
|
303
|
+
The
|
304
|
+
.B \-optimize
|
305
|
+
option to
|
306
|
+
.B cjpeg
|
307
|
+
is worth using when you are making a "final" version for posting or archiving.
|
308
|
+
It's also a win when you are using low quality settings to make very small
|
309
|
+
JPEG files; the percentage improvement is often a lot more than it is on
|
310
|
+
larger files. (At present,
|
311
|
+
.B \-optimize
|
312
|
+
mode is always selected when generating progressive JPEG files.)
|
313
|
+
.SH ENVIRONMENT
|
314
|
+
.TP
|
315
|
+
.B JPEGMEM
|
316
|
+
If this environment variable is set, its value is the default memory limit.
|
317
|
+
The value is specified as described for the
|
318
|
+
.B \-maxmemory
|
319
|
+
switch.
|
320
|
+
.B JPEGMEM
|
321
|
+
overrides the default value specified when the program was compiled, and
|
322
|
+
itself is overridden by an explicit
|
323
|
+
.BR \-maxmemory .
|
324
|
+
.SH SEE ALSO
|
325
|
+
.BR djpeg (1),
|
326
|
+
.BR jpegtran (1),
|
327
|
+
.BR rdjpgcom (1),
|
328
|
+
.BR wrjpgcom (1)
|
329
|
+
.br
|
330
|
+
.BR ppm (5),
|
331
|
+
.BR pgm (5)
|
332
|
+
.br
|
333
|
+
Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
|
334
|
+
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
|
335
|
+
.SH AUTHOR
|
336
|
+
Independent JPEG Group
|
337
|
+
.PP
|
338
|
+
This file was modified by The libjpeg-turbo Project to include only information
|
339
|
+
relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
|
340
|
+
features not present in libjpeg.
|
341
|
+
.SH BUGS
|
342
|
+
Support for GIF input files was removed in cjpeg v6b due to concerns over
|
343
|
+
the Unisys LZW patent. Although this patent expired in 2006, cjpeg still
|
344
|
+
lacks GIF support, for these historical reasons. (Conversion of GIF files to
|
345
|
+
JPEG is usually a bad idea anyway.)
|
346
|
+
.PP
|
347
|
+
Not all variants of BMP and Targa file formats are supported.
|
348
|
+
.PP
|
349
|
+
The
|
350
|
+
.B \-targa
|
351
|
+
switch is not a bug, it's a feature. (It would be a bug if the Targa format
|
352
|
+
designers had not been clueless.)
|