Closed dbuenzli closed 12 years ago
If you don't pass -s then it's lossless mode.
Ah yes thanks. I think I got confused by my reading of the Refinement section in jbig2enc.html.
So I guess what I really want is perceptually lossless to avoid the letter swaps. And if I understand correctly refinement would bring me that, so the question is, is it implemented and working (even if it's only via the API) ?
Thanks.
On Fri, Jan 20, 2012 at 3:17 PM, Daniel Bünzli reply@reply.github.com wrote:
Ah yes thanks. I think I got confused by my reading of the Refinement section in jbig2enc.html.
So I guess what I really want is perceptually lossless to avoid the letter swaps. And if I understand correctly refinement would bring me that, so the question is, is it implemented and working (even if it's only via the API) ?
I typically found that symbol encoding + perfect refinement was basically the same size as generic region encoding, which is why I didn't pursue it too far.
Last time I touched it (years ago!), I believe that the code actually worked, but that Acrobat crashed when trying to render it.
I'm afraid better symbol distinction would be nice, it's just not something that I got around to doing.
Cheers
AGL
Adam Langley agl@imperialviolet.org http://www.imperialviolet.org
Ok. Thanks for the answer.
Best.
P.S. Email me if you are interested in a nice letter swap example -- beyond that, the results are still impressive.
Is it possible to generate PDF with lossless compression? pdf.py doesn't seem to work without symbols file
@annulen Using generic region coding is lossless.
pdf.py is an example of the more complex PDF integration. Generic region coding is just like any other image file, however, and should be simple enough to embed in a PDF.
Sorry for possibly off-topic question, but what open source tools should I use to bundle PDF from these generic coded JBIG2 files? Google search gives me only jbig2 -s + pdf.py option
Quite long time ago I've created project using IText and PDFBox libraries to replace images in PDF with their recompressed versions using JBIG2 [1]. Maybe it could be useful for your usecase or you could get some inspiration how to use those libraries and write some simple PDF generator.
@rhatlapa, thanks for trying to help but it seems like pdfrecompressor uses the same dictionary coding (-s) as pdf.py, and I don't see any way to disable it to use lossless encoding.
@agl: from what you've written it seems that bundling generic coded JBIG2 files into one PDF is simpler task than what pdf.py does. What tool are you using for this task?
I think that pdf.py
can reasonably easily be tweaked to bundle standalong JBIG2 images into a PDF but I don't have anything lying around.
Indeed, here is a very quick version of the pdf.py script that takes a list of jbig2 files as arguments and produces a pdf to stdout – I only had to remove DecodeParms reference to the symbols file: https://gist.github.com/kmlyvens/b532c7aec2fe2bd8214ae2b3faf8f741
Now I am able to produce a pdf by these commands:
for f in .pbm; do jbig2 -p -v "$f" > "${f%.pbm}.jb2"; done ~/pkg/jbig2enc/pdfsimp.py .jb2 > foo.pdf
Hello,
I tried jbig2enc on some files but the result ends with unwanted letter swaps (n/u, b/h, I can provide a test file if needed).
Is it possible to get lossless compression with jbig2enc ? Tried with -r but it tells me to bug agl.
Thanks,
Daniel