[texhax] Smaller image-heavy pdf

Daniel Nemenyi daniel at pompo.co
Mon Nov 26 11:27:38 CET 2018


Dear all,

Thanks for the responses!

>>   > > Have you tried:    > ps2pdf in.pdf out.pdf
It certainly does reduce the filesize, but not quite sufficiently 
(from 87M to 66M) for the purposes of email-distribution, and as 
Ulrike says, it looses the url links as well.

> Apart from "image-heavy" you haven't told us much about
> this. Can the images be compressed (for example, if they
> are pngs)? Can the resolution be decreased? What fonts are
> embedded? If they are "standard" fonts they need not be
> embedded.

Fair point. In this PDF there are 36 images, mostly jpegs, one 
png, one or two PDFs, and their total average filesize is 
2.6M. Yes, I could reduce their filesize prior to compilation, but 
I would prefer not to for the following reasons:

1) The (Lua)LaTeX is being produced by a number of editors in 
Overleaf. I can only think of how to reduce the image filesizes in 
bash (eg with `convert`) so doing this would require sharing the 
files with a server I have control over (Overleaf supports 
dropbox/owncloud folder). I'm not against this route, but would 
prefer a simpler way. Maybe it's possible to reduce filesizes via 
Lua? (must admit I have never written a line of lua code!) Or 
maybe, arara (which i only learned about in the latest TUGboat and 
still don't know very much about!)

2) Another problem is that because images are cropped within LaTeX 
by means of, eg \includegraphics[trim={1cm 0 0 0},clip]{foo.jpg}, 
they would appear in the PDF massively over-cropped if their 
resolution is shrunk, unless there's a way that I'm not aware of 
to apply a relative crop-size (eg 20%) rather than an absolute one 
in cm or px?

As for fonts, we do indeed embed three ttf fonts (Noto, PT sans, 
Lato). Are fonts which are not used but are loaded with fontspec's 
\newfontfamily embeded in the pdf? We might be calling a couple of 
ligatures where that is the case. Looks like `pdfsizeopt` could 
compress the fonts effectively, but still, the real problem is all 
the huge images.

Regarding Jerry's suggestion,

> the full version of Adobe Acrobat DC has several options to 
> reduce PDF sizes.

I'm personally a GNU/Linux user so this would be difficult for me, 
but moreover, I would like to ultimately automate this process 
somehow via an online form that all my magazine's editors can 
access.

Thanks and regards
Daniel



More information about the texhax mailing list