Graphics, Figures & Tables ⇒ Trim margin of an EPS image
Trim margin of an EPS image
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?
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?
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Trim margin of an EPS image
Regarding images in EPS format it seems to me that you are better with the bounding box coordinates when including them.
See the graphicx manual for details.
Thorsten
Code: Select all
\includegraphics[bb=<llx> <lly> <urx> <ury>]{file}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 351
- Joined: Sat Aug 02, 2008 8:47 am
Trim margin of an EPS image
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}
Re: Trim margin of an EPS image
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?
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?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Trim margin of an EPS image
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.sycats wrote:[…] Somehow i feel maybe it's because beamer and graphicx don't cooperate very well?
[1] View topic: Avoidable mistakes
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Trim margin of an EPS image
Once again thank you localghost. Here is part of the code:localghost wrote: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.sycats wrote:[…] Somehow i feel maybe it's because beamer and graphicx don't cooperate very well?
\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.
Trim margin of an EPS image
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.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Trim margin of an EPS image
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!
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!
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10