MINIDJVU(1)

MINIDJVU πŸ’…βœ¨

okay bestie, gather round, because we're talking about minidjvu β€” she's the encode/decode girlie for black-and-white DjVu pages, she's part of the minidjvu-0.8 era, and honestly? she eats. πŸŽ€


✨ NAME ✨

minidjvu β€” encode/decode black-and-white DjVu pages πŸ¦‹


✨ SYNOPSIS ✨

so here's the whole vibe, single page:

minidjvu  [options] input_file output_file

and the multipage compression has basically the same energy:

minidjvu  [options] input_files output_file

if you wanna know the deets on that second one, scroll down to MULTIPAGE ENCODING, i got you. πŸ’œ


✨ DESCRIPTION ✨

minidjvu encodes and decodes single-page black-and-white DjVu files. no cap. πŸ–€πŸ€

she's derived from DjVuLibre, which is, like, the primary support library for DjVu β€” the og, the blueprint, the blueprint bestie.

and listen, she's not just a bitonal DjVu girl. besides bitonal DjVu, minidjvu also understands:

  • Windows BMP
  • PBM
  • TIFF (through libtiff)

both inputfile and outputfile can be BMP, PBM, TIFF or DjVu. how does she know which one you mean? the file type is determined by extension, periodt. and yes, input and output may coincide β€” she can handle that. 🫢

when you give her a DjVu-to-DjVu job, minidjvu decodes, then re-encodes the image. heads up though: DjVu layers other than bitonal picture are lost. gone. evaporated. πŸ’€

you can specify a bitmap-to-bitmap job, but it's relatively useful only with the --smooth option. like, it works, but it's giving... niche.

one more thing that's lowkey iconic: all options preceded by two hyphens can be used with one hyphen. why? to make the minidjvu interface more familiar for DjVuLibre users. thoughtful queen behavior. πŸ‘‘


✨ MULTIPAGE ENCODING ✨

to activate the multipage mode, either:

  • specify more than just one input file on your command line, or
  • pass minidjvu a single multipage tiff document

by default (aka if --indirect is not specified), the compressed pages get stored into a single bundled document under the name you provided in the command line. cute, compact, one file. 🎁

there are several options referring to the multipage encoding process, namely:

  • --pages-per-dict
  • --indirect
  • --report

✨ OPTIONS ✨

okay this is the big one, stay with me bestie, we're going through ALL of them πŸ’–

  • -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. that part's locked in.

This option turns on --match automatically. no extra work for you, slay.

  • -c, --clean β€” Remove small black marks that are probably noise. but bestie, be careful: 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 of:
    • a single index file
    • several single-page DjVu files (one per each image passed to the encoder)
    • 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 latter 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. one flag, four vibes. πŸ’…
  • -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 the --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. trade-offs, bestie.
  • -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. 😭 honestly, relatable.
  • -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. like reading someone's diary but it's just compression logs. πŸ“–
  • -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 suppressed. under Windows the 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. 😭 that's it, that's the bug, go forth and be warned.

and that's the whole page, bestie!! πŸ’– this was the minidjvu manual, brought to you by the minidjvu-0.8 girlies, dated July 2009 β€” yes she's an elder but she's still iconic, and you're gonna encode some black-and-white DjVu pages with her and it's gonna be slay. bye bestie, love you, read your man pages!! πŸ«Άβœ¨πŸŽ€