How to draw a 3D image stack with tikz? (See the image below)
- 263
-
I think we've already seen this question: https://tex.stackexchange.com/q/316455/1952 – Ignasi Sep 04 '19 at 11:32
2 Answers
Here is an example that defines a new \imagestack command. The stack is created by drawing the frames in the background on a background layer.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\pgfdeclarelayer{bg}
% set the order of the layers (main is the standard layer)
\pgfsetlayers{bg,main}
% \imagestack{image_name}{position}{path_to_image}
\newcommand{\imagestack}[3] {
\node[inner sep=0, draw] (#1) at (#2) {\includegraphics[width = 2cm]{#3}};
\coordinate (offset) at (0.05cm, 0.05cm);
% draw on the background layer
\begin{pgfonlayer}{bg}
\foreach \i in {3,...,1}
\filldraw[draw=black, fill=white] ($(#1.south east) + \i*(offset)$) rectangle ($(#1.north west) + \i*(offset)$);
\end{pgfonlayer}
}
\imagestack{image}{{0,0}}{example-image-a}
\end{tikzpicture}
\end{document}
- 263
-
There's no really need for complex definitions: check what copy
shadowdoes (from theshadowslibrary). – Claudio Fiandrino Sep 04 '19 at 10:54 -
Following the recommendations of Ignasi and Claudio Fiandrino, the best solution is probably to use the shadows library. See the example below:
\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{shadows}
\begin{document}
\begin{tikzpicture}
\tikzset{imageStack/.style={
draw=black,
double copy shadow={shadow xshift=5ex, shadow yshift=2.5ex},
fill=white,
inner sep=0}}
\node [imageStack] (exampleImageStack) {\includegraphics{example-image-a}};
\end{tikzpicture}
\end{document}
Source: https://mirror.informatik.hs-fulda.de/tex-archive/graphics/pgf/base/doc/pgfmanual.pdf
- 263

