Graphics, Figures & Tableshow to crop (trim) half of the picture?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
Turkurz
Posts: 31
Joined: Fri Jul 23, 2010 6:36 am

how to crop (trim) half of the picture?

Post by Turkurz »

Hello,

how can I achieve to import only the left part of the picture?

I am using dpfloat package.

Currently I have:
\begin{figure}[t]
\begin{leftfullpage}
\includegraphics[trim=0 0 1168 0, clip=true, width=\textwidth]{Image-JohnHowe-Moria.jpg}
\end{leftfullpage}
\end{figure}
\begin{figure}[t]
\begin{fullpage}
\includegraphics[trim=1169 0 0 0, clip=true, width=\textwidth]{Image-JohnHowe-Moria.jpg}
\end{fullpage}
\end{figure}
What I would like is to have a large image on two pages on top of each page. I can't find any command like \width or \originalwidth, or \picturewidth or \imagewidth in order to trim only the left/right half of the picture.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
nphaibk
Posts: 23
Joined: Fri Sep 19, 2008 4:34 pm

Re: how to crop (trim) half of the picture?

Post by nphaibk »

I have the same question, but not an answer :(

---------------GOT THE ANSWER-----------
1. add a new length command:
\newlength{\imagewidth} % the name can be chosen, e.g. picwidth...

2. before using \imagewidth, set the width of image to it by:
\settowidth{\imagewidth}{\includegraphics{yourimage}}

3. when using in calculation, remember to add {}, like this \imagewidth{}:
\includegraphics[trim = 0 0 0.5\imagewidth{} 0, clip=true, width=4cm]{yourimage} % get the left part of your image
Post Reply