CJB2(1)

✨ CJB2(1) ✨

okay bestie, welcome to section 1 of the manual, where we talk about cjb2 β€” the simple DjVuBitonal encoder from DjVuLibre-3.5. she's not complicated, she's just really good at her one job πŸ’…


πŸŽ€ NAME πŸŽ€

cjb2 β€” simple DjVuBitonal encoder. that's it, that's the whole identity, and she ate πŸ”₯


🌸 SYNOPSIS 🌸

cjb2 [options] inputfile outputdjvufile

πŸ’– DESCRIPTION πŸ’–

So basically, this is a simple encoder for bitonal files. the argument inputfile is the name of a PBM or bitonal TIFF file containing a single document image. and this program produces a DjVuBitonal file named outputdjvufile. that's the whole pipeline, no cap ✨

The default compression process is lossless: if you decode the DjVuBitonal file at full resolution, you get an image exactly identical to the input file. like, pixel for pixel, iconic behavior honestly πŸ‘‘

Lossy compression gets switched on by options -losslevel, -lossy, or -clean. so if you want your files smol, you gotta say so πŸ¦‹


πŸ’… OPTIONS πŸ’…

  • -dpi n β€” specify the resolution info that gets encoded into the output file, expressed in dots per inch. the resolution info in DjVu files is what tells the decoder how to scale the image on a particular display. meaningful resolutions range from 25 to 1200. for TIFF files the default resolution is the resolution specified by the input file. for PBM files the default resolution is 300 dpi. πŸŽ€
  • -lossless β€” make sure the encoded image is pixel-per-pixel equal to the initial image. this option is equivalent to -losslevel 0 and it's the default. the safe queen, the no-notes option πŸ’–
  • -clean β€” only remove flyspecks from the input image. this option enables a heuristic algorithm that removes very small marks. such marks are often caused by noise and dust during the scanning process, which is so real of scanners honestly πŸ™ˆ. the threshold mark size is chosen according to the resolution specified with option <span>β€”</span> yeah the manpage literally just says "with option" and then stops, bestie, I'm not gonna invent a flag for you, that's on the original 😭. this option is equivalent to -losslevel 1.
  • -lossy β€” substitute patterns with small variations. in addition to the flyspeck removal heuristic, this option enables an algorithm that encodes certain characters by simply replicating the shape of a previously encoded character with a similar shape. this option is equivalent to -losslevel 100. matching shapes, main character energy, she's copying her friend's fit πŸ’…
  • -losslevel x β€” specify how aggressive the lossy compression is. its argument ranges from 0 to 200. higher values generate smaller files with more potential distortions. loss level 0 corresponds to lossless encoding. loss level 1 performs image cleaning but does not perform character substitution at all. loss level 100 is intended to provide a good compromise. higher loss levels provide marginally better compression at the risk of unacceptable character substitutions πŸ’€ so like, be careful up there.
  • -verbose β€” display informational messages while running. she's yapping (affectionately) so you know what's happening πŸ—£οΈβœ¨

πŸ¦‹ REMARKS πŸ¦‹

Lossless encoding is competitive with that of the Lizardtech commercial encoders. we love a free queen out-performing the paid ones 🫢

Lossy encoding has made much progress thanks to Ilya Mezhirov from the minidjvu project. this also means that the lossy encoding performance can change from version to version β€” so lowkey don't get attached to one exact output. when lossy compression yields inadequate results, simply revert to only using option -clean or reduce the parameter of option -losslevel. glow-down your aggressiveness, glow-up your accuracy 🌸

Two features are still missing:

  • Half-tone detection. collecting small marks belonging to half-tone patterns would improve compression speed. (not here yet, we're manifesting ✨)
  • Multi-page compression. matching characters on several pages would improve the compression ratios for multi-page documents. (also not here yet, also manifesting πŸŽ€)

🌈 CREDITS 🌈

This program was initially written by LΓ©on Bottou <leonb@users.sourceforge.net> and was improved by Bill Riemers <docbill@sourceforge.net> and many others. the pattern matching algorithm for lossy compression was contributed by Ilya Mezhirov <ilya@mezhirov.mccme.ru>. TIFF input routines are inspired by the ones contributed by R. Keith Dennis <dennis@rkd.math.cornell.edu> and Paul Young. absolute legends, every single one of them πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

djvu(1), pbm(5). go read those next, bestie, iykyk πŸ’œ


and that's the whole page, mwah πŸ’– β€” this was DjVuLibre-3.5, dated 10/11/2001, page CJB2(1). drink water, back up your files, periodt ✨