I would like to determine the size of a TikZ picture programmatically somehow. Is there a way to do that? Here's a simple MWE where I can estimate the size to be around 8cm x 11cm by knowing the block sizes and counting the node distances between them. But a more complex TikZ picture would make estimating the finished size more difficult.
MWE
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
[bigblock/.style={draw, rectangle, minimum size=5cm},
smallblock/.style={draw, rectangle, minimum size=2cm}
]
\node [bigblock] (box1) {};
\node [bigblock, above=of box1] (box2) {};
\node [smallblock, right=of box2] (box3) {};
\end{tikzpicture}
\end{document}

\show\pgfextractxcommand and combined it with the answer here https://tex.stackexchange.com/questions/8260/what-are-the-various-units-ex-em-in-pt-bp-dd-pc-expressed-in-mm to convert pts to mm – EarthIsHome Sep 22 '21 at 16:30cm(to avoid closure of question as duplicate). A title asking about "size" is easier found by others than asking about "bounding box", so I think it would be nice. Then also post your solution. – hpekristiansen Sep 22 '21 at 16:37