2

I have a large PDF document that includes lot of complex figures. To build these figures I used the viewport feature of the \includeGraphics command from Graphics package extensively. I am aware that cropping images like this does not actually crop them and only asks the renderer to display them as cropped.

My viewports only cover rather small regions of the image. I need to reduce the size of the PDF for online publication. Are there any post processing tricks that can be applied to the PDF to flatten/recrop the images via the renderer to reduce the size? Ideally without removing vector graphics or reducing image quality.

I am aware this feature is not in Latex but it is a very important post processing optimization for the Latex viewport feature if such a workflow exists.

closed as off-topic by Martin Schröder, Sebastiano, Milo, Stefan Pinnow, TeXnician Aug 7 '18 at 6:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Martin Schröder, Sebastiano, Milo, Stefan Pinnow, TeXnician
If this question can be reworded to fit the rules in the help center, please edit the question.

  • you say postprocess, but I think the best chance here is doing this as a pre-process to crop your images before inclusion. If they are bitmap images that should be feasible, if they are vector graphics, it depends... – David Carlisle Aug 6 '18 at 15:17
  • Unfortunately, that would be extremely labor intensive at this point and not particularly feasible. Also, this seems like a PDF optimization that some tool probably supports and the community deserves an answer on how to post-process such PDFs. – Skylion Aug 6 '18 at 15:30
  • given how the clipping is implemented I suspect a post processor would be very hard to produce, but I may be wrong, someone may have done it, already, it's a big world:-) – David Carlisle Aug 6 '18 at 15:31
  • I don't see why it should be labour intensive at all, so long as you have a tool that can crop images. just redefine \includegraphics so it writes the viewports to a file, and use that file to script the clipping of all the files to the viewports. – David Carlisle Aug 6 '18 at 15:33
  • It hadn't occurred to me redefine includegraphics to output to a file; that's a good idea. – Skylion Aug 6 '18 at 16:27