Graphics, Figures & TablesTrim margin of an EPS image

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sycats
Posts: 5
Joined: Wed Sep 08, 2010 9:07 pm

Trim margin of an EPS image

Post by sycats »

i've been trying to use the trim option of \includegraphics to get rid of the white margin around some eps figures. The figures were generated using the generic postscript printer. i've opened them using gsview and found no problems.

It seems like it works because the figure has been "magnified" comparing to the untrimmed version. However the margins still exist. i've tried some really big numbers for the trim option, just to make sure that it was not because i did not crop enough white space. The result shows the picture has been really crippled, but still the margins were there. So i know it was not the problem with the trim numbers.

Is it because i got to set width and length separately, and latex tried to maintain the picture ratio so
that some extra space was added?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Trim margin of an EPS image

Post by localghost »

Regarding images in EPS format it seems to me that you are better with the bounding box coordinates when including them.

Code: Select all

\includegraphics[bb=<llx> <lly> <urx> <ury>]{file}
See the graphicx manual for details.


Thorsten
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Trim margin of an EPS image

Post by CrazyHorse »

sycats wrote:i've been trying to use the trim option of \includegraphics to get rid of the white margin around some eps figures. The figures were generated using the generic postscript printer. i've opened them using gsview and found no problems.

It seems like it works because the figure has been "magnified" comparing to the untrimmed version. However the margins still exist. i've tried some really big numbers for the trim option, just to make sure that it was not because i did not crop enough white space. The result shows the picture has been really crippled, but still the margins were there. So i know it was not the problem with the trim numbers.

Is it because i got to set width and length separately, and latex tried to maintain the picture ratio so
that some extra space was added?

Code: Select all

\includegraphics[trim=x0 y0 x1 y1,clip]{image}
Herbert
sycats
Posts: 5
Joined: Wed Sep 08, 2010 9:07 pm

Re: Trim margin of an EPS image

Post by sycats »

Thanks CrazyHorse and LocalHost. I am sorry if i did not explain it clearly. I got the trim option working, however the margins are still there even though the figure itself has been "zoomed in".

Now i realized it might be the problem with beamer. I tried the same includegraphics in regular report style, it works perfectly. However in beamer when i wanted to include the figure within a slide, that's when the problem occurs. i've increased the dlx dly parameters to the point that the content i wanted to keep had been crippled, and yet the margin remained. It looks like part of the figure is covered by a white sheet.

Somehow i feel maybe it's because beamer and graphicx don't cooperate very well?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Trim margin of an EPS image

Post by localghost »

sycats wrote:[…] Somehow i feel maybe it's because beamer and graphicx don't cooperate very well?
What makes assume that? Perhaps it's better to show the difficulties by means of a minimal example [1]. In the past I had no problems.

[1] View topic: Avoidable mistakes
sycats
Posts: 5
Joined: Wed Sep 08, 2010 9:07 pm

Trim margin of an EPS image

Post by sycats »

localghost wrote:
sycats wrote:[…] Somehow i feel maybe it's because beamer and graphicx don't cooperate very well?
What makes assume that? Perhaps it's better to show the difficulties by means of a minimal example [1]. In the past I had no problems.
Once again thank you localghost. Here is part of the code:

\documentclass[pdf, colorBG, slideColor, frames]{prosper}

\usepackage{graphicx}
...

\begin{slide}{Example}
\tiny
\begin{center}
\includegraphics[height = 0.7\textheight, trim = 30 100 30 280, clip, angle = 270]{timer}
\end{center}
\end{slide}

It's a simple straightforward code which shouldn't have any problem. Again I tried the \includegraphics line in a regular report template, and it works fine, no extra white margin. It is just when I deployed the same line to the prosper environment that I was experiencing this problem. Like I said, it's like covering the figure with a white sheet: i got the part cut out, however it leaves a big white space. And I noticed the bigger the crop, the bigger the white space, which extends to cover the header portion of the slide.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Trim margin of an EPS image

Post by frabjous »

Please actually read the links localghost posted about how to create a minimal working example and the Post on Avoidable Mistakes, since it's pretty clear you still haven't.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Trim margin of an EPS image

Post by localghost »

It's advisable to read stuff that others post here. And as frabjous also mentioned, this applies especially to links on essential forum topics. Especially new members are encouraged to read the forum announcements on top of every forum category.

Regarding the problem let me mention that the prosper class is obsolete [1]. It's obvious to replace it with powerdot. The next step then will be that you provide enough useful information that enables us to comprehend the problem clearly.

[1] View topic: Obsolete packages and document classes — Avoid usage!
Post Reply