CPALDJVU(1)

πŸ’– CPALDJVU β€” bestie's guide to the DjVu low-color encoder πŸ’–

okay so this is cpaldjvu, part of DjVuLibre-3.5, and she's here to turn your cute little low-color images into DjVu documents. pull up a chair 🫢


✨ NAME ✨

cpaldjvu β€” DjVuDocument encoder for low-color images. that's it, that's the girl πŸ’…


✨ SYNOPSIS ✨

cpaldjvu [options] inputppmfile outputdjvufile

✨ DESCRIPTION ✨

so cpaldjvu is a DjVuDocument encoder built for images that only have, like, a few colors. it literally eats those for breakfast πŸ“

it's at its absolute best on images with big solid color areas β€” think screen dumps, screenshots, that kind of thing. and the compression ratios on those? SO much higher than what GIF or PNG can do. not even close. iconic behavior honestly πŸ‘‘

here's the tea on how it works, step by step:

  1. first it reduces the number of distinct colors down to a small value you specify, using a simple color quantization algorithm.
  2. then it takes the dominant color and encodes it into the background layer.
  3. and all the other colors? they get encoded into the foreground layer.

periodt. that's the whole strategy πŸ’…


✨ OPTIONS ✨

  • -dpi n β€” sets the resolution info that gets baked into the output file, measured in dots per inch. why does this matter? because the resolution encoded in DjVu files is literally what tells the decoder how to scale the image on a particular display. meaningful values range from 25 to 6000. default is 300 dpi. 🌈
  • -colors n β€” sets the maximum number of distinct colors the color quantization algorithm is allowed to use. default is 256. ngl, smaller values can produce much smaller files, so if size is your main character moment, go lower πŸ’š
  • -bgwhite β€” makes the background layer use the lightest quantified color instead of the dominant color. little switch-up, big difference ✨
  • -verbose β€” shows informational messages while it's running, so you can watch her work. obsessed πŸŽ€

✨ REMARKS ✨

⚠️ heads up bestie: the color quantization might introduce severe degradation if your image has photographic areas with a huge number of very similar colors. like, it can get rough. 😭

if you're hitting quantization problems, the move is to pre-process the input file with a different quantization program instead β€” something like ppmquant. that can fix it 🫢

and one more thing: avoid the error diffusion dithering algorithm. do not do it. it generates random dithering patterns that might be very costly to encode. it's giving expensive for no reason πŸ’€


✨ BUGS ✨

real talk: this program should be rewritten as a pre-processor for csepdjvu. that's the honest truth, we're just saying it πŸ™ˆ


✨ CREDITS ✨

this program was initially written by LΓ©on Bottou <leonb@users.sourceforge.net> and was improved by Bill Riemers <docbill@sourceforge.net> β€” plus many others. legends only πŸ‘‘βœ¨


✨ SEE ALSO ✨

djvu(1), pbm(5), ppmquant(1), pnmtogif(1), pnmtopng(1) β€” go read those too, iykyk πŸ“šπŸ’œ


and that's the whole page, bestie! this one's from DjVuLibre-3.5, dated 10/11/2001, and it lives under the name CPALDJVU(1) in the manual. slay, go compress something πŸ’–πŸ¦‹πŸŒΈ