Decodes and renders a DjVu file.
Synopsisdjvutopnm [options] djvufilename [pnmfilename]Description --- File "djvutopnm.cpp" illustrates how to decode and render a DjVu file using class DjVuImage. This program decodes all variants of DjVu files, including the wavelet files produced by c44, and produces PNM files (see PNM and RLE file formats).
Arguments --- Argument djvufilename is the name of the input DjVu file. A single dash "-" represents the standard input. Argument pnmfilename is the name of the output PNM file. Omitting this argument or specifying a single dash "-" represents the standard output.
Output Resolution --- Three options control the resolution of the output PNM image. At most one of these three options can be specified. The default resolution, used when no other option is specified, is equivalent to specifying -scale 100.
- -N
- This option (e.g "-3" or "-19") specifies a subsampling factor N. Rendering the full DjVu image would create an image whose dimensions are N times smaller than the DjVu image size.
- -scale N
- This option takes advantage of the dpi field stored in the "INFO" chunk of the DjVu image (cf. DjVuInfo). Argument N is a magnification percentage relative to the adequate resolution for a 100dpi device such as a screen.
- -size WxH
- This option provides total control on the resolution and the aspect ratio of the image. The vertical and horizontal resolutions will be separately adjusted in such a way that the complete DjVu image is rendered into a PNM file of width W and height H.
Rendering Mode Selection --- The default rendering mode merges all the layers of the DjVu image and outputs an adequate PNM file. IW44 files Compound djVu files and Photo DjVu files are always rendered as PPM files. Bilevel DjVu files are rendered as PBM files if the subsampling factor is 1. Otherwise, they are rendered as PGM files because the resolution change gives better results with anti-aliasing. Three options alter this default behavior.
- -black
- Renders only the foreground layer mask. This mode does not work with IW44 files because these files have no foreground layer mask. The output file will be a PBM file if the subsampling factor is 1. Otherwise the output file will be an anti-aliased PGM file.
- -foreground
- Renders only the foreground layer on a white background. This mode works only with Compound DjVu files. The output file always is a PPM file.
- -background
- Renders only the background layer. This mode works only with Compound DjVu files and IW44 files. The output file always is a PPM file.
Other Options --- The following two options are less commonly used:
- -segment WxH+X+Y
- Selects an image segment to render. Conceptually, djvutopnm renders the full page using the specified resolution, and then extracts a subimage of width W and height H, starting at position (X,Y) relative to the bottom left corner of the page. Both operations of course happen simultaneously. Rendering a small subimage is much faster than rendering the complete image. Note that the output PNM file will always have size WxH.
- -v
- Causes djvutopnm to print abundant information about the structure of the DjVu file, the compression ratios, the memory usage, and the decoding and rendering times.
Alphabetic index Hierarchy of classes