[R-pkg-devel] Some, but not all vignettes compressed
Bryan Hanson
h@n@on @end|ng |rom dep@uw@edu
Thu Apr 25 20:54:49 CEST 2024
Thank you so much Ivan for investigating. I didn’t even notice the *increase*! The results of the tests you requested are very interesting:
R > tools::compactPDF("doc", gs_quality = "none", verbose = TRUE)
qs_quality="none" : use_gs=FALSE, use_qpdf=TRUE
#{pdf}s = length(paths) = 8
- doc/Vig_01_Start_Here.pdf: only qpdf: res=0;
==> (new=45281)/(old=45281) = 1 .. not worth using
- doc/Vig_02_Conceptual_Intro_PCA.pdf: only qpdf: res=0;
==> (new=441808)/(old=442464) = 0.998517 .. not worth using
- doc/Vig_03_Step_By_Step_PCA.pdf: only qpdf: res=0;
==> (new=422940)/(old=423750) = 0.998088 .. not worth using
- doc/Vig_04_Scores_Loadings.pdf: only qpdf: res=0;
==> (new=342335)/(old=341955) = 1.00111 .. not worth using
- doc/Vig_05_Visualizing_PCA_3D.pdf: only qpdf: res=0;
==> (new=692950)/(old=693206) = 0.999631 .. not worth using
- doc/Vig_06_Math_Behind_PCA.pdf: only qpdf: res=0;
==> (new=571600)/(old=571761) = 0.999718 .. not worth using
- doc/Vig_07_Functions_PCA.pdf: only qpdf: res=0;
==> (new=389451)/(old=389747) = 0.999241 .. not worth using
- doc/Vig_08_Notes.pdf: only qpdf: res=0;
==> (new=39131)/(old=39131) = 1 .. not worth using
Looks like my version of qpdf (which I think shipped with R) can’t reduce the sizes.
R > tools::compactPDF("doc", gs_quality = "ebook", gs_cmd = "/opt/homebrew/bin/gs", verbose = TRUE, qpdf = "")
qs_quality="ebook" : use_gs=TRUE, use_qpdf=FALSE
#{pdf}s = length(paths) = 8
- doc/Vig_01_Start_Here.pdf: gs: res=0;
==> (new=50865)/(old=45281) = 1.12332 .. not worth using
- doc/Vig_02_Conceptual_Intro_PCA.pdf: gs: res=0;
==> (new=1.00061e+07)/(old=442464) = 22.6146 .. not worth using
- doc/Vig_03_Step_By_Step_PCA.pdf: gs: res=0;
==> (new=5.76371e+06)/(old=423750) = 13.6017 .. not worth using
- doc/Vig_04_Scores_Loadings.pdf: gs: res=0;
==> (new=5.41358e+06)/(old=341955) = 15.8312 .. not worth using
- doc/Vig_05_Visualizing_PCA_3D.pdf: gs: res=0;
==> (new=1.23619e+07)/(old=693206) = 17.833 .. not worth using
- doc/Vig_06_Math_Behind_PCA.pdf: gs: res=0;
==> (new=818313)/(old=571761) = 1.43122 .. not worth using
- doc/Vig_07_Functions_PCA.pdf: gs: res=0;
==> (new=1.36534e+06)/(old=389747) = 3.50315 .. not worth using
- doc/Vig_08_Notes.pdf: gs: res=0;
==> (new=41780)/(old=39131) = 1.0677 .. not worth using
So my version of gs blows things up!
Also modified the above using gs_quality = “printer” or “screen” and the results are very similar.
Bryan
> On Apr 25, 2024, at 11:26 AM, Ivan Krylov <ikrylov using disroot.org> wrote:
>
> В Thu, 25 Apr 2024 08:54:41 -0700
> Bryan Hanson <hanson using depauw.edu> пишет:
>
>> 'gs+qpdf' made some significant size reductions:
>> compacted 'Vig_02_Conceptual_Intro_PCA.pdf' from 432Kb to 143Kb
>> compacted 'Vig_03_Step_By_Step_PCA.pdf' from 414Kb to 101Kb
>> compacted 'Vig_04_Scores_Loadings.pdf' from 334Kb to 78Kb
>> compacted 'Vig_06_Math_Behind_PCA.pdf' from 558Kb to 147Kb
>> compacted 'Vig_07_Functions_PCA.pdf' from 381Kb to 90Kb
>
> I'm getting similar (but not same) results on Debian Stable, gs 10.00.0
> & qpdf 11.3.0:
>
> # R CMD build --no-resave-data --compact-vignettes=both
> compacted ‘Vig_01_Start_Here.pdf’ from 244Kb to 45Kb
> compacted ‘Vig_02_Conceptual_Intro_PCA.pdf’ from 432Kb to 143Kb
> compacted ‘Vig_03_Step_By_Step_PCA.pdf’ from 411Kb to 100Kb
> compacted ‘Vig_04_Scores_Loadings.pdf’ from 335Kb to 78Kb
> compacted ‘Vig_05_Visualizing_PCA_3D.pdf’ from 679Kb to 478Kb
> compacted ‘Vig_06_Math_Behind_PCA.pdf’ from 556Kb to 145Kb
> compacted ‘Vig_07_Functions_PCA.pdf’ from 378Kb to 89Kb
> compacted ‘Vig_08_Notes.pdf’ from 239Kb to 39Kb
>
>
>> - doc/Vig_01_Start_Here.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=49942)/(old=45101) = 1.10734 .. not worth using
>> - doc/Vig_02_Conceptual_Intro_PCA.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=1.00061e+07)/(old=442210) = 22.6275 .. not worth using
>> - doc/Vig_03_Step_By_Step_PCA.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=5.763e+06)/(old=423484) = 13.6085 .. not worth using
>> - doc/Vig_04_Scores_Loadings.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=5.41409e+06)/(old=341680) = 15.8455 .. not worth using
>> - doc/Vig_05_Visualizing_PCA_3D.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=1.23622e+07)/(old=692901) = 17.8412 .. not worth using
>> - doc/Vig_06_Math_Behind_PCA.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=816690)/(old=571493) = 1.42905 .. not worth using
>> - doc/Vig_07_Functions_PCA.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=1.36419e+06)/(old=389478) = 3.50262 .. not worth using
>> - doc/Vig_08_Notes.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=40919)/(old=38953) = 1.05047 .. not worth using
>
> Thank you for providing this data! Somehow, instead of compacting the
> PDFs, one of the tools manages to blow them up in size, as much as ~23
> times.
>
> Can you try tools::compactPDF() separately with gs_quality = 'none'
> (isolating qpdf) and with qpdf = '' (isolating GhostScript)?
>
> If the culprit turns out to be GhostScript, it may be due to their
> rewritten PDF rendering engine (now in C instead of PostScript with
> special extensions) not being up to par when the PDF file needs to be
> compressed. If it turns out to be qpdf, we might have to extract the
> exact command lines and compare results further.
>
> --
> Best regards,
> Ivan
=============
Bryan A. Hanson
Prof. Emeritus, DePauw University
Chemistry & Biochemistry
hanson using depauw.edu
profbryanhanson using gmail.com
Nerdy blog: ChemoSpec.org
I’m at GMT -7 year round
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list