Windows version JBIG2 Encoder-Jbig2.exe
This page only offer Window version jbig2 Encoder, for more solution, please visit Open Source Jbig2 Encoder and Decoder.
If you want Windows Dynamic Libary, please visit Lossless JBIG2 Encoder Windows Dynamic Libary
About JBig2enc Win32 version
This is a Windows version of agl’s jbig2enc compiled by RubyPdf software under Windows XP with GCC4.2(MingW32+MSYS).
I also modified pdf.py to let it works under windows, the main feature of pdf.py is convert jbig2 to PDF.
with the jbig2, you can easily convert other format image to PDF.
Change logs
Oct 26, 2010, jbig2enc win32 version update to 0.27.
Nov 2, 2009
*pdf.py create correct PDF to stdout under windows
for details, please visit http://blog.rubypdf.com/2009/11/03/how-to-let-python-send-binary-data-to-stdout-under-windows/
*fix a bug, that jbig2.exe -p can not get the correct content, also stdout issue.
Oct 29, 2009
first release,
successfully compiled jbig2.exe
pdf.py can create correct PDF to file under windows
About jbig2enc
This 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/
download agl-jbig2enc-win32-0.27 (468k)
download here
reference,
Convert JBIG2 to PDF with free and open source software agl’s jbig2enc
How to Let Python Send Binary data to stdout under Windows
P.S.
If you want to Linux bin version, please download here.
It is free software, but donations are welcome.
29 Comments
Other Links to this Post
-
샘처럼의 떽 이야기? — July 9, 2011 @ 5:08 pm
RSS feed for comments on this post. TrackBack URI
By admin, July 10, 2011 @ 12:17 am
include the modified version pdf.py into the last jbig2.exe, thanks for your introduction.
By Armin, September 8, 2011 @ 6:25 pm
Hi Steven,
thanks for the port to windows. It works very good, produces small pdf-file sizes. Only one strange thing happens. The generate pdf files have a huge page-size. For example if I process A4-size pages (29.7×20.9cm) @400dpi tiff or png the pdf file size is 164.9×116.6 cm.
Is it possible to fix this by the python pdf.py or is jbig2.exe responible for this?
Thanks
Armin
By admin, September 9, 2011 @ 1:27 am
Hi Armin,
Thanks for your comment.
In fact, I am not familiar with python, and I notice the last version pdf.py use 600 as default dpi, and after check the source code of jbig2, I modify the pdf.py to automatically get the x resolution(xres) and y resolution(yres), so the real with or pdf page is 72*width/xres, and height is 72*height/yres.
Please check the modified pdf.py, and let me know if it is correct or not.
Thanks in advance.
P.S. I also sent you an Email with the same content.
By admin, September 9, 2011 @ 10:17 am
Hi Steven,
thank you very much for your quick response, and the new pdf.py
which works perfect. (I checked it with my 400dpi page scans.
the pdf page size is now of the same size as the scans)
Thank you so much,
Greetings from rainy Germany
Armin
By Neel Roy, September 11, 2011 @ 1:34 am
Hi Admin,
Greetings
Could you kindly let me know which exact version of python do I need to install to get this to run ?
By Neel Roy, September 11, 2011 @ 2:09 am
Hi,
I executed jbig2.exe and got several output files and 1 output.sym file. I placed these along with pdf.py under pyhton installation dir and executed it…
This is what I got…
———————————————–
C:\Python27>python pdf.py output> jbig2.pdf
Traceback (most recent call last):
File “pdf.py”, line 173, in
main(sym, pages)
File “pdf.py”, line 128, in main
contents = Obj({}, ‘q %d 0 0 %d 0 0 cm /Im1 Do Q’ % (72*width/xres, 72*heigh
t/yres))
ZeroDivisionError: integer division or modulo by zero
———————————————–
Not sure what am I doing wrong
By Neel Roy, September 11, 2011 @ 2:40 am
I think I got what was causing…some indentation error
At least i am not getting any error now and pdf file is being generated, but its a single page (whereas there are atleast 140 output files) BLANK pdf and I am getting error while trying to read with adobe
By admin, September 13, 2011 @ 10:35 am
I use python2.7 on my windows 7 (64-bit)
By admin, September 13, 2011 @ 10:36 am
maybe it is a bug, please send me the image to test, thanks in advance.
By admin, October 4, 2011 @ 3:00 pm
fixed the bug when xres/yres is zero, can download the jbig2.zip again, or directly view the pdf.py source code.
By Michael, October 7, 2011 @ 8:15 pm
Hello!
I downloaded latest complect (download agl-jbig2enc-win32-0.27 (468k) ) and tried to use it with one image.
After launching “jbig2.exe -s -p book_1.tif” I got output.0000 and output.sym.
Then I launched “pdf.py output > out.pdf”. My final pdf-file has size 0. I get this error:
> D:\tst>pdf.py output > out.pdf
> File “D:\tst\pdf.py”, line 148
> print str(doc)
> ^
> SyntaxError: invalid syntax
What do I do wrong?
By Michael, October 7, 2011 @ 9:09 pm
Installed python 2.7 instead 3.2 and now pdf.py create pdf-file. But if I try to open it Adobe Reader 9 writes “insufficient data for an image”.
Files output.0000 and output.sym together has size about 16kb, but created pdf-file is about 12kb.
What can be wrong?
By Michael, October 10, 2011 @ 4:35 pm
Finally got everything worked.
Pdf.py should be corrected like it is written in this page. I thought that it is already correct.
By admin, October 16, 2011 @ 9:51 am
Could you give me a picture to test, thanks in advance
By WMJ, October 17, 2011 @ 9:43 am
Thanks for publishing the compiled EXE file. It does save me a lot of works. Is it possible to compile it as a win32 DLL file which exposes methods in jbig2enc.h?
By WMJ, October 17, 2011 @ 9:47 pm
I am having trouble to work with the EXE file on .NET. I tried to start a process and capture the content from stdout to a byte array. The problem is that LF is turned into CR-LF by the system, which results incorrect result.
Is it possible to specify an output file name from the parameters or provide a DLL file so I can use DllImport to work with it?
By WMJ, October 17, 2011 @ 9:49 pm
I am having trouble to work with the EXE file on .NET. I tried to start a process and capture the content from stdout to a byte array. The problem is that LF is turned into CR-LF by the system, which leads to incorrect results.
Is it possible to specify an output file name from the parameters or provide a DLL file so I can use DllImport to work with it?
By WMJ, October 19, 2011 @ 12:36 pm
I’ve recompiled the encoder and simply added a line before sending any data to stdout which has fixed the LF->CR-LF issue.
The line is:
_setmode (1, O_BINARY);
(add the above line before each “write(1, ret, length);”)
By admin, October 19, 2011 @ 12:53 pm
Great.
By Xonir, November 23, 2011 @ 9:25 pm
Hello Michael,
I have the same problem..I got blank PDF and Acrobat 9 returns the error: “insufficient data for an image”. How have you solved this issue?
By admin, November 24, 2011 @ 11:04 am
if possible, please give me the sample image. thanks in advance.
By Tuan Nguyen, December 20, 2011 @ 12:34 am
Hi all,
Default jbig2enc support lossless compression. I would like to know how we can apply lossy algorithm?
Thanks,
Tuan Nguyen.
By scribbleed, January 12, 2012 @ 3:54 pm
I am just getting a black PDF. I’ve sent an email to you with the test images I used.
By admin, January 18, 2012 @ 4:18 am
sorry, I did not get the test images, could you send me again? thanks.
By scribbleed, January 25, 2012 @ 4:24 pm
I’ve resent the email to rubypdf. Please have a look.
By Joe, April 3, 2012 @ 12:53 pm
Hi,Admin
Could you please also compile the JBIG2DEC and send the exe file to me. I need it to do some experiments. But i am a beginner and dont know how to compile it.
Thank you so much!
By admin, April 6, 2012 @ 11:08 pm
You can download the windows pre-compiled version here,
http://bfo.com/products/pdf/jbig2/
and if you want the last version, please let me know.
By Bob, August 30, 2012 @ 5:09 pm
Hi,
When running “pdf.py output > out.pdf” on Win7 I am getting:
(width, height,xres,yres) = struct.unpack(‘>IIII’, contents[11:27])
struct.error: unpack requires a string argument of length 16″
Any ideas?