RubyPDF Blog Linux,Open Source,PDF,Softwares,Windows Convert JBIG2 to PDF with free and open source software agl’s jbig2enc

Convert JBIG2 to PDF with free and open source software agl’s jbig2enc

agl’s jbig2enc is an encoder for JBIG2:
www.jpeg.org/public/fcd14492.pdf

JBIG2 encodes bi-level (1 bpp) images using a number of clever tricks to get
better compression than G4. This encoder can:
* Generate JBIG2 files, or fragments for embedding in PDFs
* Generic region encoding
* Perform symbol extraction, classification and text region coding
* Perform refinement coding and,
* Compress multipage documents

It uses the (Apache-ish licensed) Leptonica library:
http://www.leptonica.com/

Jbig2enc can convert other format image to jbig2 or fragments for embedding in PDFs, and pdf.py can convert the fragments to PDF document.
for example, if you want to convert a.bmp to pdf, you can do it in this way
jbig2 -s -p a.bmp
you get output.0000 and output.sym files
python pdf.py output>jbig2.pdf
btw, itext and itextsharp also supports convert jbig2 to pdf now.
After some efforts, I have successfully compiled jbig2 under Window XP with GCC 4.2(MingW32+MSYS), for details and download, please visit Windows version of agl’s jbig2enc, from this page, you can also download the linux compiled version.

reference,
Windows version of agl’s jbig2enc
agl’s jbig2enc home page

7 thoughts on “Convert JBIG2 to PDF with free and open source software agl’s jbig2enc”

  1. Woof Woof!

    Trying to build a pdf running pdf.py, This error message is showed

    python pdf.py output>jbig2.pdf
    File “pdf.py”, line 7
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    Ho can I solve?

  2. Re-Woof

    Ok, previous pdf.py was wrong, Now I have downloaded the right file but an error message is showed

    # python pdf.py output>jbig2.pdf
    Traceback (most recent call last):
    File “pdf.py”, line 159, in
    usage(“symbol table %s not found!”% sym)
    TypeError: usage() takes exactly 2 arguments (1 given)
    # python pdf.py output>jbig2.pdf
    Traceback (most recent call last):
    File “pdf.py”, line 159, in
    usage(“symbol table %s not found!”% sym)
    TypeError: usage() takes exactly 2 arguments (1 given)

    line 159 is this:

    usage(“symbol table %s not found!”% sym)

    How Must I modify to get pdf.py working?

  3. You should use jbig2.exe(windows) or Jbig2(Linux) to get the output.0000 and output.sym
    by using this command, “jbig2 -s -p a.jpg

  4. Thanks I just realized my error

    when I typed in console command to encode, I added the -S switch while omitting pdf.py works fine. a powerful program.

    my university tends to make too large files when scans public domain books so I think jbig is a good utility to recompress all images and then assembling in pdf

  5. you should try pdfsizeopt, maybe which is the best choise for you, but, pdfsizeopt only works well under Linux now, and I am working on the porting job to let it works under Windows.
    btw, neither jbig2 or pdfsizeopt is developed by me, I just found them and do some jobs on them.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.