agl / jbig2enc

JBIG2 Encoder
Other
252 stars 86 forks source link

jbig2 pdf pages out of order #9

Closed laur-zz closed 14 years ago

laur-zz commented 14 years ago

I am converting a series of 57 TIFF G4 compressed images to jbig2 and pdf, the images are of the form image-000.tif, image-001.tif, etc. I am using the command "jbig2 -s -p image*.tif" and "python pdf.py output > image-jbig2.pdf". The resultant pdf has the pages all out of sequence, for example the first page is #28 in the series, the second page is #23, the third is #43, etc. Tested with the Windows and Linux binaries from rubypdf.

agl commented 14 years ago

The images are compressed in the order given on the command line, which is up to the shell. Try echo image*.tif and see what order is being given.

laur-zz commented 14 years ago

I tested this and the shell is expanding the wild card properly, i.e. image-000.tif, image-001.tif, etc. I even tried list=ls image*.tif ; jbig2 -s -p $list with the exact same results (after verifying that $list was correct). I also built jbig2 from source instead of using the binaries, same result. I've tried with a couple different series of images and different numbers of images, in all cases the pages seem to be randomly ordered, I can't figure out the pattern.

agl commented 14 years ago

Sorry, I wasn't thinking about pdf.py. It just needed to sort the array. See edebc5acf9b287c0dcd9ce08ebc7b88150de507f

laur-zz commented 14 years ago

Thanks a lot, works great!