5

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.

1

1 Answer 1

10

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.

3
  • Thanks. I know of trim, but how can I find the image width? Also, why do you need clip?
    – Tim N
    Jun 10, 2013 at 16:49
  • @TimN: trim didn't work without clip.
    – m0nhawk
    Jun 10, 2013 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. Jun 10, 2013 at 17:06

Not the answer you're looking for? Browse other questions tagged .