# [Tex/LaTex] Tikz: Node positioning relative to external image height or node height

graphicspositioningtikz-pgf

I have an external picture and I want to put some labels on it. The code below works fine, but I want to automate the calculation of the vertical label positions in case of resizing the imported external figure. Is there a way to obtain the height of the node probe or the image itsels and to use that in the positioning inside [above right = 2cm and 1cm of probe], e.g. something like [above right = 0.25*\imageheight and 1cm of probe] ?

\documentclass[a4paper,10pt]{scrreprt}
\usepackage[T1]{fontenc}
% \usepackage[utf8]{inputenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=25mm, top=25mm, bottom=25mm}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
\node[inner sep=0pt] (probe) at (0,0){\includegraphics[width=.25\textwidth]{test}};
\node[above right = 2cm and 1cm of probe](adherent1label) at (probe.east) {Adherent 1};
\node[below right = 2cm and 1cm of probe](adherent2label) at (probe.east) {Adherent 2};

\end{tikzpicture}
\end{document}


First solution with calc TiKZlibrary:

\documentclass[a4paper,10pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=25mm, top=25mm, bottom=25mm}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}

\begin{document}

\begin{tikzpicture}
\node[inner sep=0pt] (probe) at (0,0){\includegraphics[width=.25\textwidth]{example-image}};
\path let \p1=($(probe.north west)$),
\p2=($(probe.south east)$),
\n{height} = {veclen(\y1,\y2)},
\n{width}= {veclen(\x1,\x2)} in
node[above right = 1.2*\n{height} and 0.75*\n{width} of probe](adherent1label) at (probe.east) {Adherent 1};
\node[below right = 2cm and 1cm of probe](adherent2label) at (probe.east) {Adherent 2};

\end{tikzpicture}
\end{document}


Second solution with \tcbsetmacroto{width|height} commands from tcolorbox skin library:

\documentclass[a4paper,10pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=25mm, top=25mm, bottom=25mm}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[skins]{tcolorbox}

\begin{document}

\begin{tikzpicture}
\node[inner sep=0pt] (probe) at (0,0){\includegraphics[width=.25\textwidth]{example-image}};
\tcbsetmacrotowidthofnode{\imagewidth}{probe}
\tcbsetmacrotoheightofnode{\imageheight}{probe}