3

I have an image that is too wide to be displayed on a page. I'd like to cut the middle part of the image. The edges should be ragged to help the reader understand that a part is missing.

Example:

mrks
  • 171

1 Answers1

4

This can be done using tikz and adjustbox:

\usepackage{adjustbox}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{decorations.pathmorphing}
\newcommand{\cutimage}[3]{
  \adjustbox{max width=\textwidth}{
    \tikz{
      \node[inner sep=0pt] (A) {
        \adjustbox{trim={0} {0} {#2\width} {0},clip}{\includegraphics{#1}}
      };
      \draw[decoration={zigzag, mirror,segment length=6mm,amplitude=1.1pt}, decorate](A.north east) -- (A.south east)
    }
    \tikz{
      \node[inner sep=0pt] (A) {
        \adjustbox{trim={#3\width} {0} {0} {0},clip}{\includegraphics{#1}}
      };
      \draw[decoration={zigzag, mirror,segment length=6mm,amplitude=1.1pt}, decorate](A.north west) -- (A.south west)
    }
  }
}

Usage:

\cutimage{image.png}{.65}{.87}

Thanks go out to these answers from which I have borrowed parts:

mrks
  • 171