CJB2(1) DjVuLibre-3.5 CJB2(1)NAME
cjb2 - Simple DjVuBitonal encoder.
SYNOPSIS
cjb2 [options] inputfile outputdjvufile
DESCRIPTION
This is a simple encoder for bitonal files. Argument inputfile is the name of a PBM or bitonal TIFF file containing a single document
image. This program produces a DjVuBitonal file named outputdjvufile.
The default compression process is lossless: decoding the DjVuBitonal file at full resolution will produce an image exactly identical to
the input file. Lossy compression is enabled by options -losslevel, -lossy, or -clean.
OPTIONS -dpi n Specify the resolution information encoded into the output file expressed in dots per inch. The resolution information encoded in
DjVu files determine how the decoder scales the image on a particular display. Meaningful resolutions range from 25 to 1200. The
default resolution for TIFF files is the resolution is the resolution specified by the input file. The default resolution for PBM
files is 300 dpi.
-lossless
Ensure that the encoded image is pixel-per-pixel equal to the initial image. This option is is equivalent to -losslevel 0 and is
the default.
-clean Only remove flyspecks from the input image. This option enables a heuristic algorithm that removes very small marks. Such marks
are often causes by noise and dust during the scanning process. The threshold mark size is chosen according to the resolution spec-
ified with option This option is is equivalent to -losslevel 1.
-lossy Substitute patterns with small variations. In addition to the flyspeck removal heuristic, this option enables an algorithm that
encodes certain characters by simply replicating the shape of a previously encoded character with a similar shape. This option is
is equivalent to -losslevel 100.
-losslevel x
Specify the aggressiveness of the lossy compression. Its argument ranges from 0 to 200. Higher values generate smaller files with
more potential distortions. Loss level 0 corresponds to lossless encoding. Loss level 1 performs image cleaning but does not per-
form character substitution at all. Loss level 100 is intended to provide a good compromise. Higher loss levels provide marginally
better compression at the risk of unacceptable character substitutions.
-verbose
Display informational messages while running.
REMARKS
Lossless encoding is competitive with that of the Lizardtech commercial encoders.
Lossy encoding has made much progress thanks to Ilya Mezhirov from the minidjvu project. This also means that the lossy encoding perfor-
mance can change from version to version. When lossy compression yields inadequate results, simply revert to only using option -clean or
reduce the parameter of option -losslevel.
Two features are still missing:
* Half-tone detection. Collecting small marks belonging to half-tone patterns would improve compression speed.
* Multi-page compression. Matching characters on several pages would improve the compression ratios for multi-page documents.
CREDITS
This program was initially written by Leon Bottou <leonb@users.sourceforge.net> and was improved by Bill Riemers <docbill@sourceforge.net>
and many others. The pattern matching algorithm for lossy compression was contributed by Ilya Mezhirov <ilya@mezhirov.mccme.ru>. TIFF
input routines are inspired by the ones contributed by R. Keith Dennis <dennis@rkd.math.cornell.edu> and Paul Young.
SEE ALSO djvu(1), pbm(5).
DjVuLibre-3.5 10/11/2001 CJB2(1)
Check Out this Related Man Page
DIDJVU(1) didjvu manual DIDJVU(1)NAME
didjvu - DjVu encoder with foreground/background separation
SYNOPSIS
didjvu separate [{-o | --output} output-mask] [option...] input-image
didjvu separate --output-template name-template [option...] input-image...
didjvu encode [{-o | --output} output-djvu] [option...] input-image
didjvu encode --output-template name-template [option...] input-image...
didjvu bundle [{-o | --output} output-djvu] [option...] input-image...
didjvu {--version | --help | -h}
DESCRIPTION
didjvu uses the Gamera[1] framework to separate foreground/background layers, which can be then encoded into a DjVu file.
didjvu separate generates images mask(s) for the supplied input image(s). Masks are saved in the PNG format.
didjvu encode converts the supplied input image(s) to single-page DjVu documents(s).
didjvu bundle converts the supplied input image(s) to a bundled multi-page DjVu document.
OPTIONS
didjvu accepts the following options:
Input, output
-o, --output=output-djvu
Generate a bundled multi-page document. Write the file into output-djvu file instead of standard output.
For separate and encode commands this option is allowed only if there is exactly one input file (i.e. exactly one output file).
--output-template=template
Specifies the naming scheme for output files for the separate and encode commands. Please consult the "TEMPLATE LANGUAGE" section for
the template language description.
This option is mandatory if there is more than one input file (i.e. more than one output file).
--pageid-template=template
Specifies the naming scheme for page identifiers for the bundle command. Please consult the "TEMPLATE LANGUAGE" section for the
template language description. The default template is "{base-ext}.djvu".
For portability reasons, page identifiers:
o must consist only of lowercase ASCII letters, digits, _, +, - and dot,
o cannot start with a +, - or a dot,
o cannot contain two consecutive dots,
o must end with the .djvu extension.
Masks
--loss-level=n
Specifies the aggressiveness of the lossy compression for the separate and encode commands. The default is 0 (lossless). Valid values
are integers between 0 and 200, inclusive.
This option is similar to the -losslevel option of cjb2; please consult the cjb2(1) manual page for details.
--lossless
Synonym for --loss-level=0.
--clean
Synonym for --loss-level=1.
--lossy
Synonym for --loss-level=100.
-m, --method=method
Use the selected method to generate image mask (i.e. separate foreground from background). The following methods should be available:
abutaleb
Abutaleb locally-adaptive thresholding algorithm
bernsen
Bernsen thresholding algorithm
djvu
DjVu thresholding algorithm
niblack
Niblack adaptive thresholding algorithm
otsu
Otsu thresholding algorithm
sauvola
Sauvola adaptive thresholding algorithm
shading-subtraction
thresholds an image after subtracting a possibly shaded background
Note
this method requires Gamera >= 3.3.1
tsai
splitting along a threshold value determined using the Tsai Moment Preserving Threshold algorithm
white-rohrer
White and Rohrer dynamic thresholding algorithm
The default is 'djvu'.
Please consult the Gamera documentation[2] for details.
-p, --pages-per-dict=n
For bundle command: if n > 1, compress mask using minidjvu using n pages in one pass. The default is 1.
--masks, --mask=input-mask
Use the pre-generated image masks for the encode and bundle commands.
Foreground/background quality, resolution
(These options apply to encode and bundle commands only.)
-d, --dpi=resolution
Specifies the desired resolution to resolution dots per inch. The default is 300 dpi. The allowed range is: 72 <= resolution <= 6000.
--fg-slices=n
Specifies the encoding quality of the IW44 foreground layer. The default is 100.
This option is similar to the -slice option of c44; please consult the c44(1) manual page for details.
--fg-crcb=normal
Select normal chrominance encoding of the foreground layer.
--fg-crcb=half
Select half resolution chrominance encoding of the foreground layer.
--fg-crcb=full
Select the highest possible quality for encoding the chrominance information of the foreground layer. This is the default.
--fg-crcb=none
Disable the encoding of the chrominance of the background layer.
--fg-subsample=n
Specifies the foreground/background subsampling ratio. The default is 6. Valid values are integers between 1 and 12, inclusive.
--bg-slices=n+...+n, --bg-slices=n,...,n
Specifies the encoding quality of the IW44 background layer. The default is 74+10+6+7.
This option is similar to the -slice option of c44; please consult the c44(1) manual page for details.
--bg-crcb=normal
Select normal chrominance encoding of the background layer. This is the default.
--bg-crcb=half
Select half resolution chrominance encoding of the background layer.
--bg-crcb=full
Select the highest possible quality for encoding the chrominance information of the background layer.
--bg-crcb=none
Disable the encoding of the chrominance of the background layer.
--bg-subsample=n
Specifies the foreground/background subsampling ratio. The default is 3. Valid values are integers between 1 and 12, inclusive.
XMP support
(These options apply to encode command only.)
--xmp
Create sidecar XMP[3] metadata.
Note
This option is experimental!
Verbosity, help
-v, --verbose
Display more informational messages while converting the file.
-q, --quiet
Don't display informational messages while converting the file.
--version
Output version information and exit.
-h, --help
Display help and exit.
ENVIRONMENT
The following environment variables affects didjvu:
TMPDIR
didjvu makes havy use of temporary files. It will store them in a directory specified by this variable. The default is /tmp.
TEMPLATE LANGUAGE
Template syntax
The template language uses the Python string formatting syntax[4].
Available field names
name
Input file path.
name-ext
Input file path without file extension.
base
Input file name without directory components.
base-ext
Input file name without directory components and without file extension.
page, page+N, page-N
Page number, optionally offseted by a number N.
SEE ALSO djvu(1), djvumake(1), c44(1), cjb2(1), minidjvu(1),
AUTHOR
Jakub Wilk <jwilk@jwilk.net>
Author.
NOTES
1. Gamera
http://gamera.informatik.hsnr.de/
2. Gamera documentation
http://gamera.sourceforge.net/doc/html/binarization.html
3. XMP
http://www.adobe.com/devnet/xmp.html
4. Python string formatting syntax
http://docs.python.org/library/string.html#format-string-syntax
didjvu 0.2.3 02/01/2012 DIDJVU(1)