2

I would like to compress scanned text (monochrome or few colours) and store it in pdf (maybe djvu) files. I remember that I got very good results with Windows/Acrobat and "ZRLE" compressed monochrome tiff embedded into pdf. The algorithm was loossless as far as I remember. Now I search a way to obtain good results on linux. It should be storage saving and avoid loss (I do not mind loosing colours, but I do not want e.g. jpeg compression which would create noisy results for text scans). I need it for batch conversion, so I was thinking of the ImageMagick convert command. But which output format should I use so I get good results and to be able to embed it into pdf files (for example using pdflatex)? Or is it generally better to use djvu files?

highsciguy
  • 2,569
  • 3
  • 34
  • 59

2 Answers2

3

jbig2enc encoder for images using jbig2 compression, was originally written for GoogleBooks by Adam Langley

https://github.com/agl/jbig2enc

I forked to include latest improvements By Rubypdf and others

https://github.com/DingoDog/jbig2enc

I also built several binaries of jbig2enc for puppy linux (it can be working also on other distributions)

http://dokupuppylinux.info/programs:encoders

Dingo
  • 2,619
  • 1
  • 22
  • 32
2

DJVU is not a bad choice, but if you want to stay in PDF for better compatibility you may want to look into lossless JBIG2 compression.

Quote from Wikipedia:

Overall, the algorithm used by JBIG2 to compress text is very similar to the JB2 compression scheme used in the DjVu file format for coding binary images.

yms
  • 10,361
  • 3
  • 38
  • 68
  • I see, works with convert command. What about LZW compression? It seems to work with 8-bit colour images as well. Does it? http://www.chemie.fu-berlin.de/chemnet/use/suppl/imagemagick/www/Magick.html says that there are license issues. But according to the same page the license ends in 2002. Is there still reason not to use it? How can I use it with convert? "convert -compress LZW fig.png fig.tif" does not lead to significant compression in my ImageMagick. Do I need to install additioanl software? – highsciguy Dec 02 '11 at 20:26