NAME¶
minidjvu - encode/decode black-and-white DjVu pages
SYNOPSIS¶
minidjvu [options] input_file
output_file
There is a similar syntax for multipage compression:
minidjvu [options] input_files
output_file
See
MULTIPAGE ENCODING section below for more details.
DESCRIPTION¶
minidjvu encodes and decodes single-page black-and-white DjVu files.
minidjvu is derived from DjVuLibre, which is the primary support library for
DjVu.
Besides bitonal DjVu, minidjvu understands Windows BMP, PBM and TIFF (through
libtiff) formats. Both
inputfile and
outputfile may be BMP, PBM,
TIFF or DjVu. The file type is determined by extension. Input and output may
coincide.
When given a DjVu-to-DjVu job, minidjvu decodes, then re-encodes the image. DjVu
layers other than bitonal picture are lost.
Specifying a bitmap-to-bitmap job is possible, but relatively useful only with
--smooth option.
All options preceded by two hyphens can be used with one hyphen. This is done to
make minidjvu interface more familiar for DjVuLibre users.
MULTIPAGE ENCODING¶
To activate the multipage mode either specify in your command line more than
just one input file, or pass to minidjvu a single multipage tiff document. By
default (if
--indirect is not specified) the compressed pages are
stored into a single bundled document under the name provided in the command
line.
There are several options referring to the multipage encoding process, namely
--pages-per-dict, --indirect and
--report.
OPTIONS¶
- -A
- --Averaging
- Compute "average" representatives for shapes
matching a pattern.
- -a n
- --aggression n
- Sets aggression for pattern matching. The more the
aggression, the less the file size, but the more likely substitution
errors will occur. The default is 100. Usually you can raise it to about
110 more or less safely. Probably even 200 will work fine, but don't rely
on that.
Consistent aggression levels between versions is not guaranteed. The
default, however, will always be 100.
This option turns on --match automatically.
- -c
- --clean
- Remove small black marks that are probably noise. This
algorithm can really devastate halftone patterns, so use with caution.
This option is turned on by --lossy.
- -d n
- --dpi n
- Specify the resolution of an image, measured in dots per
inch. The resolution affects some algorithms and it's recorded in DjVu and
BMP files (TIFF should join someday).
- -e
- --erosion
- Sacrifice image quality to gain about 5-10% in file size.
One erosion is almost invisible, but 10 erosions in a row spoil an image
badly (and they won't give you 50-100% of file size, alas). Erosion bonus
stacks with pattern matching.
Erosion makes no sense when the output is not DjVu.
This option is turned on by --lossy.
- -i
- --indirect
-
Specifying this option in multipage mode causes minidjvu to generate an
indirect multipage document, consisting from a single index file,
several single-page DjVu files (one per each image passed to the encoder)
and several shared dictionary files. Note that the index file is created
under the name specified for the output file in the command line, while
for each page the original input file name is preserved, with the
extension being changed to ".djvu".
This mode is useful for placing a large document to a Web server, or if you
are going to postprocess the generated files (e. g. by adding a color
background). In the later case you may then want to convert your indirect
document to DjVu bundled, using the djvmcvt utility, supplied with
DjVuLibre.
- -l
- --lossy
- Turn on all lossy options. Is equivalent to --clean
--erosion --match --smooth.
- -m
- --match
- Run pattern matching. This is the main method of shrinking
the file size, but it can also bring trouble with substitution errors. Use
--aggression option to maintain balance between file size and error
probability.
This option is turned on by --lossy or --aggression.
- -n
- --no-prototypes
- Disable prototype searching. This makes lossless
compression faster, but produced files become much bigger.
- -p
- --pages-per-dict
- Specify how many pages to compress in one pass. The default
is 10. If -p 0 is specified, minidjvu will attempt to process all
pages at once, but be aware that this can take a lot of memory, especially
on large books.
- -r
- --report
- Print verbose messages about what's done on which page.
Works only with multipage encoding. Useful only to survive boredom while
compressing a book.
- -s
- --smooth
- Flip some pixels that appear to be noise. The gain in file
size is about 5%. Visually the image is slightly improved, but it's hardly
noticeable.
Current filter is dumb and only removes black pixels with at least 3 white
neighbors (of 4). You probably won't notice the effects.
This option is turned on by --lossy.
- -v
- --verbose
- Print messages about various stages of the process. It's
not very useful, but interesting to examine.
- -X
- --Xtension
- Specifies an extension for shared dictionary files (without
a leading period). The default is "iff".
- -w
- --warnings
- Do not disable libtiff warnings. By default, TIFF warnings
are supressed. Under Windows default TIFF warning handler creates a
message box. This is unacceptable in a batch processing script, for
instance. So the minidjvu default behavior is a workaround for libtiff
default behavior.
BUGS¶
Multipage encoder does not work properly if pages have different
resolution.