5

This question already has an answer here:

Is it possible to include only half an image? I'm looking to include only the right half of an image and discard the left half.

If there is a simple way to accomplish that, it would make more sense in my case than to generate new images.

marked as duplicate by Scott H., m0nhawk, egreg, Werner, Thorsten Jun 10 '13 at 17:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

9

You should use the crop and trim options for \includegraphics command.

Example:

\includegraphics[trim = 10mm 80mm 20mm 5mm, clip, width=3cm]{image}

The options for trim is: trim=left bottom right top, where it cropped by the appropriate amount from the sides.

So, including only the right half would look like:

\newlength{\imagewidth}
\settowidth{\imagewidth}{\includegraphics{image}}
\includegraphics[trim=0.5\imagewidth{} 0 0 0, clip, width = 0.1\imagewidth{}]{image}

Check the code.

  • Thanks. I know of trim, but how can I find the image width? Also, why do you need clip? – Tim N Jun 10 '13 at 16:49
  • @TimN: trim didn't work without clip. – m0nhawk Jun 10 '13 at 16:59
  • 1
    @TimN trim only reduces the size of the resulting box (you’d have overlapping on the left side), clip also clips the stuff outside of the box. – Qrrbrbirlbel Jun 10 '13 at 17:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.