TransWikia.com

Cut middle of image with zig-zag pattern

TeX - LaTeX Asked by mrks on May 9, 2021

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:

One Answer

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} {#2width} {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={#3width} {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:

Answered by mrks on May 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP