agl / jbig2enc

JBIG2 Encoder
Other
252 stars 86 forks source link

The right way to get DPI #15

Closed rubypdf closed 12 years ago

rubypdf commented 13 years ago

from jbig2_page_info struct we can get not only width and height, but also xres and yres, so we can directly use xres and yres to generated proper page size.

and here is the patch http://soft.rubypdf.com/download/jbig2/pdf.diff

btw, http://soft.rubypdf.com/download/jbig2/jbig2.zip is the win 32 static binary built with the last version source code, and also include the modified version pdf.py

P.S. to any one who want to get windows version Jbig2: please visit http://soft.rubypdf.com/software/windows-version-jbig2-encoder-jbig2-exe

agl commented 12 years ago

(This is a form response.)

I wrote jbig2enc many years ago and I'm aware that it's been very useful to some people, for which I'm glad. But I'm afraid that I simply don 't have the time to maintain it any more. Please feel free to fork it in the usual open source style. If you think you have a sufficiently we ll maintained fork, let me know and I'll start directing people to it.

Cheers

AGL

DingoDog commented 12 years ago

Thanks for this patch

I tried with some pdf resulting from jbig2enc encoding and it seems working very well

HU-HO! I spoked too soon!

We have a serious problem

if we edit images with a program that strip the original dpi info (settling to zero) we have this error:


Traceback (most recent call last): File "pdf.py", line 171, in main(sym, pages) File "./patched-pdf.py", line 129, in main contents = Obj({}, 'q %f 0 0 %f 0 0 cm /Im1 Do Q' % (float(width * 72) / xres, float(height * 72) / yres)) ZeroDivisionError: float division

rubypdf commented 12 years ago

fixed the bug when xres/yres is zero, can download the jbig2.zip again, or directly view the pdf.py source code.

mistydemeo commented 12 years ago

Thanks, @rubypdf! I've pulled this in my fork of jbig2enc at mistydemeo/jbig2enc. I'm accepting further pull requests if you have any other improvements to offer.

rubypdf commented 12 years ago

@mistydemeo, welcome. btw, @DingoDog also maintains a fork now