# 3D image stack with tikz

How to draw a 3D image stack with tikz? (See the image below)

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}


• There's no really need for complex definitions: check what copy shadow does (from the shadows library). – Claudio Fiandrino Sep 4 at 10:54
• Thank you for the advice :) – Mr.Epic Fail Sep 4 at 10:56