I have a rectangular image that I can not change.

I'd like to clip the image with a Bézier path so I get one that is rectangular at the top and the sides but has a curve at the bottom, preferable without using additional packages.

  • 1
    No package needed if you clip the image using an image editor in advance. As far as I know, graphicx can only clip images in a rectangular form. Therefore you need additional packages such as PSTricks to clip it in a curved form. Jun 5, 2011 at 12:15
  • Using an editor in advance is not an option, unfortunatelly. Additional packages are acceptable (thou a solution without them would be preferable). Jun 5, 2011 at 12:17
  • Your image in what format? eps, jpeg, png, or pdf? Jun 5, 2011 at 12:24
  • can be converted during the compile-process. let us assume it is png. Jun 5, 2011 at 13:10
  • 1
    Herbert's solution that is compiled by xelatex can import png, pdf, jpg, eps. Jun 5, 2011 at 13:13

5 Answers 5


I don't know of a way to clip an image without using additional packages (apart from graphicx, I assume). There is a way of doing it with TikZ, which is probably better than no solution.

This is based on the answers to the question Drawing on an image with TikZ. I've written a macro that takes an image name with the accompanying \includegraphics options and a TikZ path as arguments to either display the image overlaid with a grid and the path, or to use the path to clip the image. The behaviour is toggled using \tikzset{develop clipping path=true} to switch on the grid and the path display, and \tikzset{develop clipping path=false} to perform the actual clipping once the path has been developed.



    \tikzset{/tikz/develop clipping path/.is if=developpath,
      /tikz/develop clipping path=true}

    % Include the image to determine the size and set up the relative coordinate system. Enclose the \includegraphics in \phantom{} once the clipping path has been set up
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics#1};
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\phantom{\includegraphics#1}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
      % Draw grid while developing clipping path
        \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
        \draw[red, ultra thick] #2 -- cycle;
        % Use the path to clip, include the image
        \path[clip] #2 -- cycle;
        \node[anchor=south west,inner sep=0pt] {\includegraphics#1};

Show the image with a grid to help in finding the coordinates for the path.

    \clippicture{[width=0.8\textwidth]{some-image}}{(0.5,0.75) -- (0.90,0.75) -- (0.90,0.5) .. controls (0.8,-0.2) and (0.65,0.2) .. (0.5,0.3)}

    \tikzset{develop clipping path=false}
Done with developing the path. Do the actual clipping.

    \clippicture{[width=0.8\textwidth]{some-image}}{(0.5,0.75) -- (0.90,0.75) -- (0.90,0.5) .. controls (0.8,-0.2) and (0.65,0.2) .. (0.5,0.3)}

clipping an image with a bezier


run with xelatex, then a pdf image can be clipped





enter image description here

  • 1
    It is a compact solution with a nice photograph. Jun 5, 2011 at 13:09
  • You can use \pst@boxg as a temporary box. Jun 22, 2011 at 7:39
  • 1
    @xport: I know, but it requires makeatletter ....\makeatother and it is defined for internal use of PSTricks
    – user2478
    Jun 22, 2011 at 7:45

I take some ideas from Drawing on an image with Tikz but with another method and I complete the code with Jack's method for the clip image.


\tikzset{number/.style={fixed,fixed zerofill,precision=1}} 
\tikzset{spy style/.style={spy using outlines={magnification=8, size=4cm}}}
\begin{scope}[spy style] 
\node[anchor=south west,inner sep=0](GHimage){\includegraphics[width=#1]{#2}}; 
\begin{scope}[x={(GHimage.south east)},y={(GHimage.north west)}]}{% 

\node[anchor=south west,inner sep=0](GHimage){\phantom{\includegraphics[width=#1]{#2}}}; 
\begin{scope}[x={(GHimage.south east)},y={(GHimage.north west)}]}{% 

width/.code                    = \def\GH@width{#1},
height/.code                   = \def\GH@height{#1}, 
/GHShowDetail/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname

\def\GH@ShowDetail[#1] at (#2,#3)#4{
         width   = 0.1,
         height  = 0.1}
    \path (#2,#3)--++(\GH@width/2,\GH@height/2) coordinate (rightnode)
          (#2,#3)--++(-\GH@width/2,-\GH@height/2) coordinate (leftnode);
    \node [fit=(leftnode) (rightnode),
           ultra thick,draw,
           color= lightgray,
           ](#4)  {};}

/GHShowPath/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname

        \draw[#1] #2 -- cycle; 

\clip  #2 -- cycle;
\node[anchor    = south west,
      inner sep = 0](GHimage){%

color/.code         = \def\GH@anchor@col{#1},
radius/.code        = \def\GH@anchor@rad{#1},
show/.is if         = anchor@show,
show/.default       = true}

\def\GH@Anchor[#1] at (#2,#3)#4{%
color  = gray,
radius = 2pt,
show   = false}  
\coordinate (#4) at (#2,#3);
\ifanchor@show\fill[\GH@anchor@col] (#4) circle [radius=\GH@anchor@rad];\fi

color/.code         = \def\GH@grid@col{#1},
space/.code         = \def\GH@grid@space{#1},
step/.code          = \def\GH@grid@step{#1},
precision/.code     = \def\GH@grid@precision{#1}, 

color  = lightgray,
space = 0.04,
precision = 1}
\foreach \x in {0,\GH@grid@step,...,1.001}{%
    \draw[\GH@grid@col] (0,\x) ++(-\GH@grid@space,0) node[left]{%
    \pgfmathprintnumber[fixed,fixed zerofill,precision=\GH@grid@precision]
                       {\x}} -- (1,\x);
    \draw[\GH@grid@col] (\x,0) ++(0,-\GH@grid@space)node[rotate=90,left]{%
    \pgfmathprintnumber[fixed,fixed zerofill,precision=\GH@grid@precision]
                       {\x}} -- (\x,1);}}

color/.code         = \def\GH@anchor@col{#1},

  \spy  on (#1) in node at ([shift={(#3,#4)}]GHimage.#2); 


\tikzset{spy style/.style={spy using outlines={circle, magnification=4, size=3cm, connect spies}}}

   \GHAnchor[color=red,radius=2pt,show] at (0.5,0.5){milieu}   
   \GHShowDetail[shape=circle,color=red,width=.2] at (0.25,0.5){cercle}
   \GHShowDetail[shape=rectangle,width=.1,height=.1] at (0.7,0.7){rec}
   \GHShowPath[ultra thick,red]{(0.5,0.75) -- (0.90,0.75) -- (0.90,0.5) .. controls (0.8,-0.2) and (0.65,0.2) .. (0.5,0.3)} 

\GHShowClipPath[red]{(0.5,0.75) -- (0.90,0.75) -- 
    (0.90,0.5) .. controls (0.8,-0.2) and (0.65,0.2) .. (0.5,0.3)} 

enter image description here


I am not using Bezier. It is just for fun.




        \psparametricplot{0}{2.5 .25 exp}{t^2  | 0.8*(sqrt(2.5-t^4)+t)}
        \psparametricplot{2.5 .25 exp}{0}{t^2  | 0.8*(-sqrt(2.5-t^4)+t)}
        \psparametricplot{0}{2.5 .25 exp}{-t^2 | 0.8*(-sqrt(2.5-t^4)+t)}
        \psparametricplot{2.5 .25 exp}{0}{-t^2 | 0.8*(sqrt(2.5-t^4)+t)}


    \pscustom[unit=2.3cm, origin={0.5\width,0.4\height}, linecolor=cyan, dimen=middle, linewidth=3pt, algebraic]{\function}
    \psgrid[gridwidth=0.2pt, gridcolor=white, subgriddiv=1]

    \psclip{\pscustom[unit=2.3cm, origin={0.5\width,0.4\height}, linestyle=none, algebraic]{\function}}
    \psgrid[gridwidth=0.2pt, gridcolor=white, subgriddiv=1]

enter image description here


This is a clipper with bezier curves.

enter image description here

\documentclass[pstricks,border={-8.5mm -5.5mm -8.5mm -5.0mm}]{standalone}


    /theta 72 def
    /Major 6.0 def
    /Minor 3.3 def
    % b a t p2c ---> x y
    % where b (semi-minor), a (semi-major), t (theta)
    /p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def

        (!Minor Major theta p2c){I}
        (!Minor Major theta neg p2c){J}

    \psellipticarcn[dimen=middle](center)(!Major Minor){(I)}{(J)}

    \psellipticarcn[dimen=middle](center)(!Major Minor){(J')}{(I')}


%    \DeclareNodes
%    \pscustom*{\RightPart\LeftPart\closepath}




Another similar method can be seen here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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