大家好,我想用蓝色填充书本图片周围的页面颜色,但我做不到,因为这张图片覆盖了书本周围的一些额外的白色,那么如何填充图片周围的颜色呢?我的 MWE 是
\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}
答案1
如果你有足够的耐心,你可以
- 尝试沿着书的边框画一条线
- 并用
even odd rule
\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}