Blame tools/ddjvu.1

Packit df99a1
.\" Copyright (c) 2001-2003 Leon Bottou, Yann Le Cun, Patrick Haffner,
Packit df99a1
.\" Copyright (c) 2001 AT&T Corp., and Lizardtech, Inc.
Packit df99a1
.\"
Packit df99a1
.\" This is free documentation; you can redistribute it and/or
Packit df99a1
.\" modify it under the terms of the GNU General Public License as
Packit df99a1
.\" published by the Free Software Foundation; either version 2 of
Packit df99a1
.\" the License, or (at your option) any later version.
Packit df99a1
.\"
Packit df99a1
.\" The GNU General Public License's references to "object code"
Packit df99a1
.\" and "executables" are to be interpreted as the output of any
Packit df99a1
.\" document formatting or typesetting system, including
Packit df99a1
.\" intermediate and printed output.
Packit df99a1
.\"
Packit df99a1
.\" This manual is distributed in the hope that it will be useful,
Packit df99a1
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit df99a1
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit df99a1
.\" GNU General Public License for more details.
Packit df99a1
.\"
Packit df99a1
.\" You should have received a copy of the GNU General Public
Packit df99a1
.\" License along with this manual. Otherwise check the web site
Packit df99a1
.\" of the Free Software Foundation at http://www.fsf.org.
Packit df99a1
.TH DDJVU 1 "10/19/2002" "DjVuLibre-3.5" "DjVuLibre-3.5"
Packit df99a1
.SH NAME
Packit df99a1
ddjvu \- Command line DjVu decoder.
Packit df99a1
Packit df99a1
.SH SYNOPSIS
Packit df99a1
.BI "ddjvu -format=" "fmt" " [" "options" "] [" "djvufile" "] [" "outputfile" "]"
Packit df99a1
Packit df99a1
.SH DESCRIPTION
Packit df99a1
Packit df99a1
Decode the DjVu file
Packit df99a1
.IR "djvufile" ,
Packit df99a1
produces the image file
Packit df99a1
.IR "outputfile" .
Packit df99a1
Packit df99a1
The DjVu data is read from the standard input when argument 
Packit df99a1
.IR "djvufile"
Packit df99a1
is not specified or when it is equal to a single dash.
Packit df99a1
Similarly, the output data is written to the standard output
Packit df99a1
when argument 
Packit df99a1
.IR "outputfile"
Packit df99a1
is not specified or equal to a single dash.
Packit df99a1
However a valid output file name is always required when producing a
Packit df99a1
TIFF or PDF file.
Packit df99a1
Packit df99a1
.SH MAIN OPTIONS
Packit df99a1
.TP
Packit df99a1
.BI "-format=" "fmt"
Packit df99a1
Specify the output file formats.
Packit df99a1
The recognized file formats are
Packit df99a1
.BR "pbm" ,
Packit df99a1
.BR "pgm" ,
Packit df99a1
.BR "ppm" ,
Packit df99a1
.BR "pnm" ,
Packit df99a1
.BR "rle" ,
Packit df99a1
.BR "tiff" ,
Packit df99a1
and
Packit df99a1
.BR "pdf" .
Packit df99a1
.RS
Packit df99a1
.IP "*" 3
Packit df99a1
Formats 
Packit df99a1
.BR "pbm" ,
Packit df99a1
.BR "pgm" ,
Packit df99a1
and
Packit df99a1
.BR "ppm"
Packit df99a1
respectively produce a Portable Bitmap (PBM),
Packit df99a1
Portable Graymap (PGM),
Packit df99a1
or Portable Pixmap (PPM) file.
Packit df99a1
Format 
Packit df99a1
.B "pnm"
Packit df99a1
produces a PBM, PGM, or PPM 
Packit df99a1
output file according to the color content
Packit df99a1
of the output image.
Packit df99a1
.IP "*"
Packit df99a1
Format
Packit df99a1
.B "rle"
Packit df99a1
produces a compact run length encoded bitonal file
Packit df99a1
that is understood by the DjVuLibre commands
Packit df99a1
.BR "cjb2" 
Packit df99a1
and 
Packit df99a1
.BR "csepdjvu" .
Packit df99a1
.IP "*"
Packit df99a1
Format
Packit df99a1
.B "tiff"
Packit df99a1
produces a Tagged Image Format (TIFF) 
Packit df99a1
file using lossless compression.
Packit df99a1
Enabling lossy JPEG compression (see option 
Packit df99a1
.BI "-quality"
Packit df99a1
below) often produces much smaller files.
Packit df99a1
Commands 
Packit df99a1
.BR tiffcp (1)
Packit df99a1
and 
Packit df99a1
.BR tiffsplit (1)
Packit df99a1
are useful for manipulating the resulting 
Packit df99a1
TIFF files.
Packit df99a1
.IP "*"
Packit df99a1
Format
Packit df99a1
.B "pdf"
Packit df99a1
produces a Portable Document Format (PDF) file.
Packit df99a1
Each page in the resulting file is represented
Packit df99a1
by an image at the specified resolution,
Packit df99a1
using lossless compression.
Packit df99a1
Enabling lossy JPEG compression (see option 
Packit df99a1
.BI "-quality"
Packit df99a1
below) often produces much smaller files.
Packit df99a1
An alternate way to produce PDF 
Packit df99a1
file consists in first using
Packit df99a1
.BR djvups (1)
Packit df99a1
and convert the resulting PostScript file to PDF.
Packit df99a1
Which method gives better results depends
Packit df99a1
on the contents of the DJVU file and on the
Packit df99a1
capabilities of the PS to PDF converter.
Packit df99a1
.RE
Packit df99a1
.TP
Packit df99a1
.B ""
Packit df99a1
When option
Packit df99a1
.B "-format"
Packit df99a1
is not specified, 
Packit df99a1
the extension of argument
Packit df99a1
.I "outputfile"
Packit df99a1
has no influence on the default output format.
Packit df99a1
Instead the program behavior is modified to 
Packit df99a1
ensure backward compatibility with previous 
Packit df99a1
versions of 
Packit df99a1
.BR "ddjvu" .
Packit df99a1
We recommend to always specify the output
Packit df99a1
format using this option.
Packit df99a1
.TP
Packit df99a1
.BI "-page=" "pagespec"
Packit df99a1
Specify which pages should be decoded.
Packit df99a1
When this option is not specified,
Packit df99a1
all pages of the documents are decoded
Packit df99a1
and concatenated into the output file.
Packit df99a1
The page specification
Packit df99a1
.I pagespec 
Packit df99a1
contains one or more comma-separated page ranges.
Packit df99a1
A page range is either a page number, 
Packit df99a1
or two page numbers separated by a dash.
Packit df99a1
For instance, specification
Packit df99a1
.BR "1-10" 
Packit df99a1
outputs pages 1 to 10, and specification
Packit df99a1
.BR "1,3,99999-4"
Packit df99a1
outputs pages 1 and 3, followed by all the document
Packit df99a1
pages in reverse order up to page 4.
Packit df99a1
.TP
Packit df99a1
.BI "-eachpage"
Packit df99a1
When this option is specified, program
Packit df99a1
.B ddjvu
Packit df99a1
generates one separate file per page
Packit df99a1
named by replacing the 
Packit df99a1
.B %d
Packit df99a1
specification in 
Packit df99a1
.I outputfilename
Packit df99a1
by the page number 
Packit df99a1
in a manner simular to the 
Packit df99a1
.BR printf (3)
Packit df99a1
function.
Packit df99a1
.TP
Packit df99a1
.BI "-mode=" "mod"
Packit df99a1
Selects which layers of the DjVu image should be rendered.
Packit df99a1
Valid rendering modes are 
Packit df99a1
.BR "color" ,
Packit df99a1
.BR "black" ,
Packit df99a1
.BR "mask" ,
Packit df99a1
.BR "foreground" ,
Packit df99a1
and
Packit df99a1
.BR "background" .
Packit df99a1
.RS
Packit df99a1
.IP "*" 3
Packit df99a1
Rendering mode
Packit df99a1
.BR "color" 
Packit df99a1
is the default mode.
Packit df99a1
When the DjVu file is bitonal, bitonal or gray-level output
Packit df99a1
is produced depending on the subsampling factor. 
Packit df99a1
Otherwise a color image is produced.
Packit df99a1
.IP "*"
Packit df99a1
Rendering mode
Packit df99a1
.B "black"
Packit df99a1
is useful to extract a meaningful black and white image.
Packit df99a1
bitonal or gray-level output is produced depending 
Packit df99a1
on the subsampling factor. 
Packit df99a1
.IP "*"
Packit df99a1
Rendering modes
Packit df99a1
.BR "mask" ,
Packit df99a1
.BR "foreground" ,
Packit df99a1
and
Packit df99a1
.BR "background"
Packit df99a1
select specific layers of a DjVu image.
Packit df99a1
These modes can fail if the DjVu image does 
Packit df99a1
not contain the selected layer.
Packit df99a1
.RE
Packit df99a1
.TP
Packit df99a1
.BI "-skip"
Packit df99a1
Instead of aborting when encountering a corrupted page,
Packit df99a1
this option causes
Packit df99a1
.BR ddjvu
Packit df99a1
to simply skip the corrupted page and continue with the next.
Packit df99a1
This is useful for processing certain damaged files.
Packit df99a1
Packit df99a1
.SH RESOLUTION OPTIONS
Packit df99a1
The following options control the resolution of the output image.  
Packit df99a1
The default resolution is the native resolution of the DjVu file, 
Packit df99a1
equivalent to selecting
Packit df99a1
.BR "-1" .
Packit df99a1
.TP
Packit df99a1
.BI "-" "n"
Packit df99a1
Specify an integer sub-sampling factor.  
Packit df99a1
The dimensions of the full output image will be 
Packit df99a1
.I n
Packit df99a1
times smaller than the DjVu image size.
Packit df99a1
The legal values for argument
Packit df99a1
.I n
Packit df99a1
range from 1 to 12.  Option
Packit df99a1
.BR -1 ,
Packit df99a1
for instance, produces an output image whose resolution
Packit df99a1
is equal to the resolution of the input DjVu image file.
Packit df99a1
.TP
Packit df99a1
.BI "-subsample=" "n"
Packit df99a1
This is equivalent to option
Packit df99a1
.IR "-n" .
Packit df99a1
.TP
Packit df99a1
.BI "-scale=" "mag"
Packit df99a1
Specify a magnification factor relative to the resolution stored 
Packit df99a1
in the DjVu image.  Specifying magnification of 100 produces an image 
Packit df99a1
suitable for displaying on a 100 dpi device such as a computer screen.  
Packit df99a1
The magnification factor
Packit df99a1
.I "mag"
Packit df99a1
can also be interpreted as the resolution
Packit df99a1
of the output image expressed in dot per inch.
Packit df99a1
.TP
Packit df99a1
.BI "-size=" "w" "x" "h"
Packit df99a1
Specify the size of the full output image.
Packit df99a1
Rendering the full DjVu image would create an 
Packit df99a1
output image whose width and height would not exceed
Packit df99a1
.IR "w"
Packit df99a1
and 
Packit df99a1
.IR "h" .
Packit df99a1
To change the aspect ratio, you must also use option
Packit df99a1
.BR "-aspect=no" .
Packit df99a1
.TP
Packit df99a1
.BI "-aspect=" yesno
Packit df99a1
This option indicates whether the image aspect ratio
Packit df99a1
should be preserved.  The defaults is to preserve the
Packit df99a1
aspect ration. This option permits changes in the aspect ratio
Packit df99a1
when used in combination with option
Packit df99a1
.BR "-size" .
Packit df99a1
Packit df99a1
.SH OTHER OPTIONS
Packit df99a1
.TP
Packit df99a1
.BI "-verbose"
Packit df99a1
Display informational messages describing the 
Packit df99a1
structure of the DjVu image and the format
Packit df99a1
of the output file.
Packit df99a1
.TP
Packit df99a1
.BI "-segment=" "w" "x" "h" "+" "x" "+" "y"
Packit df99a1
Specify an image segment to render. 
Packit df99a1
Program
Packit df99a1
.B ddjvu
Packit df99a1
conceptually renders the full page using the specified resolution, 
Packit df99a1
and then extracts a sub-image of width
Packit df99a1
.I w 
Packit df99a1
and height
Packit df99a1
.IR h ,
Packit df99a1
starting at position 
Packit df99a1
.IR "" ( x , y )
Packit df99a1
relative to the bottom left corner of the page.
Packit df99a1
Both operations of course happen simultaneously.  Rendering a small
Packit df99a1
sub-image is much faster than rendering the complete image.  
Packit df99a1
The output file will always have size
Packit df99a1
.IR w x h 
Packit df99a1
when this option is specified.
Packit df99a1
.TP
Packit df99a1
.BI "-quality=" "factor"
Packit df99a1
Enables lossy JPEG compression for TIFF and PDF files.
Packit df99a1
This option only affects images that cannot be encoded
Packit df99a1
using the preferred TIFF/G4 compression.
Packit df99a1
Argument 
Packit df99a1
.I factor
Packit df99a1
is a quantization factor ranging from 25 to 150. 
Packit df99a1
See command 
Packit df99a1
.BR cjpeg (1)
Packit df99a1
for more information on JPEG quantization factors.
Packit df99a1
Value 80 is a good starting point.
Packit df99a1
.TP 
Packit df99a1
.BR "-quality=uncompressed"
Packit df99a1
Completely disables compression in TIFF and PDF files.
Packit df99a1
Although the resulting files are often huge,
Packit df99a1
this is sometimes useful for maximal compatibility
Packit df99a1
with hastily written software.
Packit df99a1
.TP
Packit df99a1
.BR "-quality=deflate"
Packit df99a1
Enables DEFLATE compression for TIFF files.
Packit df99a1
Images that cannot be encoded using the preferred TIFF/G4 compression
Packit df99a1
will be encoded with DEFLATE compression if available.
Packit df99a1
Otherwise the more portable PACKBITS compression is used.
Packit df99a1
Specifying this option is not necessary for PDF files
Packit df99a1
because this is the default behavior.
Packit df99a1
Packit df99a1
.SH DEPRECATED OPTIONS
Packit df99a1
Packit df99a1
Various options have been maintained to ensure
Packit df99a1
backward compatibility with previous versions of
Packit df99a1
.BR ddjvu.  
Packit df99a1
When option
Packit df99a1
.BR -format
Packit df99a1
is not specified, 
Packit df99a1
the program only decodes the first page of the document
Packit df99a1
and the default resolution becomes
Packit df99a1
.BR -scale=100 .
Packit df99a1
Options 
Packit df99a1
.BR -size ,
Packit df99a1
.BR -scale ,
Packit df99a1
.BR -segment ,
Packit df99a1
and
Packit df99a1
.BR -page 
Packit df99a1
accept an argument separated by a space.
Packit df99a1
Options
Packit df99a1
.BR -foreground ,
Packit df99a1
.BR -background ,
Packit df99a1
and
Packit df99a1
.BR -black
Packit df99a1
are shorthands for the 
Packit df99a1
.BI -mode= mod
Packit df99a1
option.
Packit df99a1
Please do not rely on these features.
Packit df99a1
Packit df99a1
Packit df99a1
.SH EXAMPLES
Packit df99a1
Command
Packit df99a1
.IP "" 3
Packit df99a1
.BI "ddjvu -format=tiff " "myfile.djvu" " " "myfile.tif"
Packit df99a1
.PP
Packit df99a1
decodes all pages and produces a multipage TIFF file.
Packit df99a1
Packit df99a1
Command
Packit df99a1
.IP "" 3
Packit df99a1
.BI "ddjvu -format=ppm -page=1-10 -eachpage -size=100x100 " "myfile.djvu" " thumb%03d.ppm"
Packit df99a1
.PP
Packit df99a1
produces 100x100 thumbnails for the first ten page of a document 
Packit df99a1
and outputs them as PPM files named
Packit df99a1
.BR thumb001.ppm
Packit df99a1
to 
Packit df99a1
.BR thumb010.ppm .
Packit df99a1
Packit df99a1
.SH CREDITS
Packit df99a1
The new version of this program was written 
Packit df99a1
by L\('eon Bottou <leonb@users.sourceforge.net>.
Packit df99a1
Packit df99a1
This program includes code derived from program
Packit df99a1
.BR tiff2pdf ,
Packit df99a1
written by Ross Finlayson and 
Packit df99a1
released under a BSD license.
Packit df99a1
Packit df99a1
.SH SEE ALSO
Packit df99a1
.BR djvu (1),
Packit df99a1
.BR djview (1),
Packit df99a1
.BR pnm (5),
Packit df99a1
.BR pbm (5),
Packit df99a1
.BR pgm (5),
Packit df99a1
.BR ppm (5),
Packit df99a1
.BR cjpeg (1),
Packit df99a1
.BR tiffsplit (1),
Packit df99a1
.BR tiffcp (1),
Packit df99a1
.BR printf (3)