0

How do I crop an .eps file for use in LaTeX when using macOS?

I tried the instructions here: What is a good workflow for importing and cropping EPS images? and it didn't work.

Specifically,

  • I began with an .eps file generated by TGIF (call it image_v1.eps)

  • I opened image_v1.eps in Preview.app

  • I Used Preview to crop the image and saved the cropped image in image_v2.pdf. Now, because cropping an image in Preview.app just hides the cropped material as opposed to removing it,

  • I ran pdfcrop --clip image_v2.pdf image_v3.pdf

  • Then I ran pdf2ps image_v3.pdf image_v3.eps

  • Finally, I included it in my LaTeX document using

    \fbox{\includegraphics[width=3in]{image_v3.eps}}

The result is that the entire original .eps file is displayed, but the fbox only appears around cropped portion of the image.

  • Adding a trim parameter to includegraphics changes the fbox, but the "extra" portion of the image is still displayed.
  • Similarly, editing the .eps file and changing the bounding box information changes the size of the fbox but the "extra" portion of the image is still displayed.

Any idea what I'm doing wrong? Should I be using a different tool at any point above?

To be clear: Adding clip=true to the includegraphics command does hide the unwanted portion of the image. However, I want to edit the .eps file so it only contains the image I want to display. I'd rather not resort to "tricking" LaTeX into displaying only part of the image.

Zack
  • 111
  • 1
    Search for the bounding box bb and clip options to include the eps file. – Sigur Nov 12 '21 at 23:46
  • 1
    Yes, you can clip the inserted image. – Sigur Nov 12 '21 at 23:55
  • It is quite difficult to remove parts from a vector graphic. That's why all cropping and clipping only hides things. – Ulrike Fischer Nov 13 '21 at 00:21
  • is there a particular reason to use latex and include eps rather than use pdflatex and include pdf? – David Carlisle Nov 13 '21 at 00:37
  • I suppose I could. But, every other document uses latex and eps. All else being equal it seems easier to keep this document consistent with the others. (I teach, so I have a lot of assignments and tests prepared in latex.) – Zack Nov 13 '21 at 01:39
  • well it doesn't make so much difference but eps is very 1980s and not so much used these days. I'm not sure pdf2ps makes eps you could try pdftops -eps image_v3.pdf image_v3.eps if you have ppdftops installed (note to not 2) or simply edit the %%BoundingBox in the file – David Carlisle Nov 13 '21 at 08:04
  • I tried editing the BoundingBox in the EPS file, and it had the same effect: The \fbox changed accordingly, but the "cropped" image outside the bounding box was still displayed. – Zack Nov 13 '21 at 13:35
  • Where would I get pdftops? It's not installed on my mac, and my Google skills are failing me. I have seen several articles pointing to using pdf2ps with the -eps flag; but my installed version of that tool doesn't recognize that switch. – Zack Nov 13 '21 at 13:40

0 Answers0