tune parameters to pdf_comp -recode

Bug #174481 reported by Hank Bromley
2
Affects Status Importance Assigned to Milestone
Deriver
Fix Released
High
Hank Bromley

Bug Description

Try to make pdf's smaller and faster to create, while maintaining adequate quality, and accessibility to main pdf viewers.

Includes:

- check that '-layers 0' does indeed fix problem on Mac Preview [see own email of Date: Mon, 5 Nov 2007 15:51:46 -0500 (EST)]; test items at:
http://ia331304.us.archive.org/~hank/adventuresoftoms00twaiiala/adventuresoftoms00twaiiala_lurajp2.pdf
http://ia331304.us.archive.org/~hank/adventuresoftoms00twaiiala/adventuresoftoms00twaiiala_lurajp2_l0.pdf
(or on any datanode)

- check that okay to switch color pdf's to '-image jp2', as b/w pdf's already are

- check results of reducing '-quality' below the default of 6

- experiment with '-sens', '-bsample' and '-fsample'

(see notes in file .../petabox/pdf_comp on laptop)

Tags: pdf
Changed in deriver:
assignee: nobody → hank-archive
status: New → Confirmed
Revision history for this message
Hank Bromley (hank-archive) wrote :

'-layers 0' does solve the "occasional inverse video" problem for Preview under 10.5 (already knew it did under 10.4) - loaded the two test files on Steve's laptop, the first was broken (p. 11) and the second was good

Changed in deriver:
importance: Undecided → High
Revision history for this message
danh (danh-archive) wrote :

I looked at the 4 pdfs posted at http://home.us.archive.org/~hank/pdftest/
and have no obvious problems using:
   Ubuntu 7.10:
   Document Viewer (evince 2.20.1)

(I.e., text and pictures look fine, and text can be highlighted showing ocr text, so that copy/paste works.)

Revision history for this message
MarcusLucero (marcus-archive) wrote :

Looked at all 4 pdf's posted at http://home.us.archive.org/~hank/pdftest/

Microsoft Windows XP Professional Version 2002:

Adobe Reader 8
FoxIT Reader 2.2
SumatraPDF-0.7
cutePDF
eXPertPDF 2.0.50

you get the picture...

Revision history for this message
brewster (brewster) wrote : Re: [Bug 174481] Re: tune parameters to pdf_comp -recode

the cinder4q... on preview is much more readable than the cinder.pdf, in
my opinion.

which is the direction of the future?

-brewster

MarcusLucero wrote:
> Looked at all 4 pdf's posted at
> http://home.us.archive.org/~hank/pdftest/
>
> Microsoft Windows XP Professional Version 2002:
>
> Adobe Reader 8
> FoxIT Reader 2.2
> SumatraPDF-0.7
> cutePDF
> eXPertPDF 2.0.50
>
> you get the picture...
>

Revision history for this message
Hank Bromley (hank-archive) wrote :

Based on all the testing and feedback (thank you especially Dan and Marcus), I've checked in the changes. Here's what I've done, along with some explanatory notes.

First, the results of the changes:

- pdfs are viewable error-free on a wider range of applications
- color pdfs are much smaller (roughly half their former size)
- grayscale pdfs are, in most cases, slightly smaller
- when viewed in most applications, text clarity is detectably better (and dramatically so in the case of Preview under Mac 10.4 - I'm attaching a pair of before/after screen shots of that)

The call to pdf_comp, for both color and grayscale pdfs, now specifies the following overrides to default values:

-layers 0 -quality 4 -fsample 1

We allow the other options to default; two of those default values of particular interest are:

-image jp2 -bsample 3

Now the explanation:

Color pdfs had been using '-image jpg' (meaning that foreground and background images were compressed using jpg compression). Switching to the default of jp2 is what shrunk them in half.

'-layers' controls whether the user can separately turn the layers on or off for viewing. (The different layers are created in any case; the option just controls whether they're individually switchable.) The default of 'layers 1' causes viewing errors in some applications, including odd "inverse video" effects in Mac Preview (under both 10.4 and 10.5). So we now use 0.

'-quality' defaults to 6 (max is 10). I could find no visible difference among quality values ranging from 4 to 8, but they do affect file size.

'-fsample' and '-bsample' control the foreground and background image downsampling rate. The default varies with the quality setting, but would be 3 in our case. Bumping '-fsample' to 1 (i.e., no downsampling at all) is what increased the text clarity (most dramatically in Preview; perhaps it does worse anti-aliasing than Acrobat Reader). It also, however, increases file size by about as much as the size was reduced by shifting '-quality' from 6 to 4. Different compromises are, of course, possible - we could, for instance, use '-fsample 2', which would shrink file size while looking indistinguishable from '-fsample 1' in some applications but somewhat worse in others.

I left '-bsample' at the default of 3, as 2 wasn't visibly better, and 4 didn't save much on file size.

Finally, here's the combined list of platforms/apps on which one of us compared the new/old pdfs and checked the new ones for error-free display:

on Ubuntu 6.06:
  Adobe Reader 7.0.1
  Document Viewer (evince 0.5.2)
  xpdf 3.01

on Ubuntu 7.10:
   Document Viewer (evince 2.20.1)

on Windows XP Professional Version 2002:
   Adobe Reader 8
   FoxIT Reader 2.2
   SumatraPDF-0.7
   cutePDF
   eXPertPDF 2.0.50

on Mac OS X 10.4.11
  Adobe Reader 8.1.1
  Preview 3.0.9

on Mac OS X 10.5
  Preview (error-checking only)

also, Marcus printed new/old grayscale pdfs of one short book on the Espresso and saw no difference

Revision history for this message
Hank Bromley (hank-archive) wrote :

(2nd attachment for previous comment - can apparently only add one attachment to each comment)

Changed in deriver:
status: Confirmed → Fix Committed
Changed in deriver:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.