Content-type: text/html Manpage of DJVUENCODE

DJVUENCODE

Section: User Commands (1)
Updated: 1998-10-23
Index Начало
 

NAME

djvuencode, tifftodjvu, tifftoiw44, pnmtodjvu, pnmtoiw44 - compress any image file to a DjVu file  

SYNOPSIS

djvuencode [ options ] [ filename [ output-filename ] ]

tifftodjvu [ options ] [ filename [ output-filename ] ]

tifftoiw44 [ options ] [ filename [ output-filename ] ]

pnmtodjvu [ options ] [ filename [ output-filename ] ]

pnmtoiw44 [ options ] [ filename [ output-filename ] ]

 

DESCRIPTION

djvuencode, tifftodjvu, tifftoiw44, pnmtodjvu, and pnmtoiw44 compresses the named image file, or the standard input if no file is named, and produces a DjVu file on the standard output, or in the specified output-file. A DjVu file (pronounced like Deja Vu) is designed specifically for scanned documents.

Typical color pages at high resolution (300DPI) occupy 30KB to 100KB. Black and White pages at 300DPI occupy 8KB to 50KB.

The DjVu compressor separates the color information (foreground and background colors, pictures, paper texture...) from the high-contrast information (text and line drawings). The former is coded at 1/3 of full resolution using a wavelet-based continuous-tone image compression technique, while the latter (a black and white, binary image) is coded at full resolution. Following the future JBIG2 standard, the method employed to code this high-resolution binary image identifies similar shapes on the page (such as multiple instances of a character in a particular font) and codes one instance together with the positions where it appears on the page. This allows extremely high compression ratios with no perceptible degradation in quality.

pnmtodjvu and pnmtoiw44 can only accept image formats of PPM, PGM, PBM, PNM, and BMP. pnmtoiw44 will produce IW44 (photo) files by default.

djvuencode and tifftodjvu can accept most graphics formats. PPM, PGM, BMP, GIF, TIFF, and JPEG are just some of the image formats that can be accepted. You can specify the image time for standard input as well by: <format>:- but only if you have ImageMagick installed. For example, one might use the following command to convert a compressed tiff file to djvu:

gunzip -c<foo.tiff.gz|djvuencode tiff:- foo.djvu

However this same conversion could be completed faster by:

gunzip -c<foo.tiff.gz|tifftodjvu - foo.djvu

Since tifftodjvu will not need an external program to do the conversion.

See convert(1) for a list of input formats accepted.

DjVu files are typically viewed using a Netscape/Internet Explorer plug-in. The recommended MIME type for such files is:

image/djvu djvu djv

image/x-iw44 iw44 iw4

iw44 is the normal extension for photographs, and djvu is the extension for documents with text and bitonal black and white images.  

OPTIONS

All the switches are follow POSIX.2 compatible short and long options.

The basic switches are:

-a,--all,--allpages
Compresses all the pages of a multipage document. When this flag is set, the output name will be the name of the directory where the DjVu files are created. (This directory will be created if it does not exist.) Each page of the document will then be converted to djvu and named with 001.djvu, 002.djvu, or 001.iw44, 002.iw44, ... respective to page number. If you use the argument to iconname will instead be treated as a file extension. AVOID using this argument in your scripts, the syntex of this argument is likely to change in future versions.
-f,--force
Force the use of the mask finding algorithm on black and white images. Sometimes this will result in smaller and better looking files. Other times this will just result in a blurred letters that take up more space. If your original document has lots of dithered regions, you should probably use this option. However, the -f this option will always require more time and memory to complete the black and white conversion.
-l,--lossless,--hifitext
For documents, use a lossless encoding scheme for the foreground/background split mask. This helps if you find that your "i"s are not being dotted properly, or your black and white image is too fuzzy. This option will also set the --fast flag for black and white documents.
-n,--normal
For documents, this uses algorithms that clean stray pixels and convert dithering back to shades. Normally this results in DjVu documents that are much smaller, and look even better than the original. This option is default for documents.
-F,--crcbfull,--fullcolor
For photos, causes full chronomantic separation to be retained, for the best color resolution. This option is default for photos, but is always disabled when converting from JPEG files, since JPEGS have already been reduced.
-H,--crcbhalf,--halfcolor
For photos, causes only half chronomantic separation to be retained. This option normally reduces the file size significantly with little noticeable loss in quality.
-h,--help
Print a screen of usage information.
-q,--quality N
Set image slice values to adjust background image quality. Quality is 0 (worst) to 100 (best); default is 75. (See below for more info.)
-r,--rotate <angle>
Rotates the image clockwise by <angle> degrees before compression. <angle> must be 90, 180, or 270. Specify 90 to rotate the image clockwise. Specify 180 to invert the image. Specify 270 to rotate the image counter-clockwise. (Note this is the opposite direction that cdjvu (1) rotates.) Using the -r option is more efficient than pnmflip(1). -P,--page N Page number to convert. This option is only valid when the input file is a multipage document, and the program convert(1) is installed.
-i,--icon <icon>
Generates a thumbnail image that is between has a width and height less than 81. When used in conjunction with the --all option, the <icon> is treated as a file extension, otherwise <icon> is the filename. For example, -ai .gif could be used to specify for each page create an GIF file as the icon.
-3,--up3,--lowlowres
Upsample and smooth the image (enlarge) by a factor of 3 before compression. This option is useful for images that do not have at least 100dpi of resolution, and otherwise would not be very readable after compression.
-2,--up2,--lowres
Upsample and smooth the image (enlarge) by a factor of 2 before compression. This option is useful for images that do not have at least 200dpi of resolution, and otherwise would not be very readable after compression.
-1,--hires
Does nothing.
-d,--dpi N
Smooth the image and resize from the specified DPI N to 300 DPI before compression.
-s,--subsample N
Subsample the image (reduce) by a factor of N before compression. This option is useful for images that are larger than 400 dpi.

The -q,--quality N switch lets you trade off compressed file size against quality of the reconstructed image: the higher the quality setting, the larger the DjVu file, and the closer the output image will be to the original input. Normally you want to use the lowest quality setting (smallest file) that decompresses into something visually indistinguishable from the original image. For this purpose the quality setting should be between 50 and 95; the default of 75 is often about right. If you see defects at -q 75, then go up 5 or 10 counts at a time until you are happy with the output image. (The optimal setting will vary from one image to another.)

Qualities lower than 50 will result in tremendous losses in the quality of the background image, without significant reduction in the file size, as this file size is always larger than the foreground/background mask and the foreground layers.

Unlike with cjpeg, the -q option does not have such a dramatic effect in the resulting image, since it only effects the background (e.g. the paper texture and color) and not the foreground (writing). Also, a -q of 100 doesn't eliminate loss in the background compression, or change the compression of the foreground/background split mask. (Use the -l option to do the latter.) Qualities higher than 95 will increase a lot the file size, without noticeable improvements in the image quality, as the latter is limited by the quality of the foreground/background separation.

To improve the quality even further, use the -2 or -3 options to upscale the image by a factor of 2(3) before compression, and/or the -l option to eliminate loss in the encoding of the foreground/background split mask.

Switches for advanced users:

-v,--verbose
Enable debug printout.
-p,--photo
Forces iw44 (photo) compression. Useful if you want to compress a photo to standard output.
-C,--nocolor,--crcbnone
Forces the image to be encoded as gray, even if the input image is color.
-g,--gamma <gamma>
Adjust the gamma factor. Normally a factor of 2.2 is used.
-m,--mask <maskfile>
Specify a mask file to separate foreground and background with.
-t,--nothick
Don't thicken letters. Normally letters are made fatter to increase readability. Sometimes this will include other things such as eyes and make people look bug eyed. In those cases, use this option.
 

EXAMPLES

This example compresses the PPM file foo.ppm with a quality factor of 60 and saves the output as foo.djv:

djvuencode -q 60 foo.ppm foo.djv
 

ENVIRONMENT

TMPDIR
Write temporary files to this directory instead of /tmp.
 

SEE ALSO

cdjvu(1), djvudecode(1), ddjvu(contrib), convert(1)
cjpeg(1), ppm(5), pgm(5)

http://www.djvu.att.com/  

PREREQUISITES

There no prerequisites for pnmtobmp. For djvuencode you should have the netpbm package installed and in your path, as djvuencode uses the following commands from it: cjpeg(1), djpeg(1), giftopnm(1), pnmquant(1), tifftopnm(1).

You should also have ImageMagick package installed and in your path, as djvuencode uses the command convert(1) from it.

If you don't install these packages then djvuencode will only convert the same file times as pnmtodjvu and pnmtoiw44.  

AUTHORS

Patrick Haffner, Leon Bottou, Paul Howard, Yann Le Cun, Joseph M. Orost, Yoshua Bengio, Bill C Riemers, Praveen Guduru  

BUGS

Sometimes areas are erroneously labelled as foreground or background in documents. For example, eyes in documents containing photos are usually mis-labelled as foreground, causing them to appear overly emphasised in the DjVu image. In those cases the user has to manually try the -t -2 -3 or -p options to eliminate the effect.

Uses LOTS of memory/swap, and a temp file (if converting from non-PNM files) space. (Needs a -maxmemory option like cjpeg.)

There should be a way to disable output from ppmquant(1) and ppmtogif(1).

The command line conversion programs are called. Ideally, the shared library routines should be used directly to avoid the need for a temporary file when converting graphic formats to PNM.

It's not as fast as we'd like.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
ENVIRONMENT
SEE ALSO
PREREQUISITES
AUTHORS
BUGS

This document was created by man2html, using the manual pages.
Time: 11:58:21 GMT, June 17, 1999