2

Hello friends I want to fill the page color with blue around the image of book but i could not do due to this image cover some extra white color around the book so how to fill color around the image. My MWE is

 \PassOptionsToPackage{svgnames,x11names}{xcolor}
 \documentclass[tikz,margin=5pt]{standalone}

 \usetikzlibrary{decorations.text} % decorations.text for the text along path feature
 \usepackage{phaistos,calligra}


 \begin{document}
 \pagecolor{green}
 \fontfamily{pzd}\selectfont
 \begin{tikzpicture}

 \pagecolor{blue}

 \node (-0.15,-5.7) {\includegraphics[scale=0.3]{book.jpg}};



 \end{tikzpicture}
 \end{document}

Output of the above code is given below enter image description here

Original image of the book image is given below enter image description here

Biki Teron
  • 3,275

1 Answers1

1

If you have a lot of patience you could

  1. draw a grid over your book with Jake's answer to Drawing on an image with TikZ

enter image description here

  1. try to draw a line along book's border

enter image description here

  1. and fill the white space between image borders and book with an even odd rule

fill the rectangle with an <code>even odd rule</code>

\PassOptionsToPackage{svgnames,x11names}{xcolor}
\documentclass[tikz,margin=5pt]{standalone}

\usetikzlibrary{decorations.text} % decorations.text for the text along path feature
\usepackage{phaistos,calligra}

\begin{document}
\pagecolor{green}
\fontfamily{pzd}\selectfont
\begin{tikzpicture}
\pagecolor{blue}

\node[anchor=south west, inner sep=0pt] (image) {\includegraphics[scale=0.3]{book.jpg}};

\begin{scope}[x={(image.south east)},y={(image.north west)}]

    \fill[blue, even odd rule] (0,0) rectangle (1,1) (0.03,0.33)--(0.45,0.97)--(0.96,.897)--(0.937,.855)--(0.937,.765)--(0.96,.76)--(.63,0.05)--(.04,.23)--cycle;

    \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);

   \foreach \x in {0,1,...,9} { \node [anchor=north, white] at (\x/10,0) {0.\x}; }
   \foreach \y in {0,1,...,9} { \node [anchor=east, white] at (0,\y/10) {0.\y}; }
\end{scope}
\end{tikzpicture}
\end{document}
Ignasi
  • 136,588