SYNOPSIS

didjvu separate [{-o | --outputoutput-mask] [option...] input-image didjvu separate --output-template name-template [option...] input-image... didjvu encode [{-o | --outputoutput-djvu] [option...] input-image didjvu encode --output-template name-template [option...] input-image... didjvu bundle [{-o | --outputoutput-djvu] [option...] input-image... didjvu {--version | --help | -h}

DESCRIPTION

didjvu uses the \m[blue]Gamera\m[]\s-2\u[1]\d\s+2 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:

must consist only of lowercase ASCII letters, digits, _, +, - and dot,

cannot start with a +, - or a dot,

cannot contain two consecutive dots,

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

brink

Brink and Pendock's minimum-cross entropy method

Note

this method requires Gamera \(>= 3.4.0

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 \(oqdjvu\(cq.

Please consult the \m[blue]Gamera documentation\m[]\s-2\u[2]\d\s+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 foreground layer.

--fg-subsample=n

Specifies the foreground 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 background subsampling ratio. The default is 3. Valid values are integers between 1 and 12, inclusive.

XMP support

(These options apply to encode and bundle commands only.)

--xmp

Create sidecar \m[blue]XMP\m[]\s-2\u[3]\d\s+2 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 \m[blue]Python string formatting syntax\m[]\s-2\u[4]\d\s+2.

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 shifted by a number N.

RELATED TO didjvu…

NOTES

1.

Gamera

\m[blue]http://gamera.informatik.hsnr.de/\m[]

2.

Gamera documentation

\m[blue]http://gamera.sourceforge.net/doc/html/binarization.html\m[]

3.

XMP

\m[blue]http://www.adobe.com/devnet/xmp.html\m[]

4.

Python string formatting syntax

https://docs.python.org/library/string.html#format-string-syntax