Use subfigure labels without multiple images in a figure

cross-referencingfloatslabelssubfloats

I'm working on a paper and the figures are quite complex. For this reason I'm making the figures as a single image in GIMP so I can arrange and place them as I like. In this single image I still manually label the parts of the figure with e.g. A and B and I would like to refer to them using \cref or \autoref. My current solution is to make a figure with mutliple subfigures but setting all the widths expect one to 0 so it only prints a single image for the figure. These 0 width subfigures do have labels which allows me to refer to them in the body of the text with\cref.

My question is: is there a more elegant way to be able to use \autoref or \cref to reference these label than just have a bunch of 0 width subfigures in my figure? Is there maybe a similar command to \phantomsubcaption to have a phantom subfigure to attach a label to?

Below I have attached my current "ugly" solution

    \begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0\textwidth}
        \centering
        \includegraphics[width=\textwidth]{images/DBS_figure_d.png}
        \phantomsubcaption
        \label{fig:test-sub-1}
    \end{subfigure}

    \begin{subfigure}[b]{1\textwidth}
        \centering
        \includegraphics[width=\textwidth]{images/DBS_figure_d.png}
        \phantomsubcaption
        \label{fig:test-sub-2}
    \end{subfigure}

    \caption{blablablablabla}
    \label{fig:test}
\end{figure}

Best Answer

Since all the links go to the top of the figure, it doesn't matter where they go. They do need to go inside a group so as to not affect the figure caption.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{hyperref}

\begin{document}
\begin{figure}[ht]
    \centering
    \includegraphics[width=\textwidth]{example-image}
    {\phantomsubcaption\label{fig:test-sub-1}%
     \phantomsubcaption\label{fig:test-sub-2}}%
    \caption{blablablablabla}
    \label{fig:test}
\end{figure}

\ref{fig:test-sub-1}\quad\subref{fig:test-sub-1}\par
\ref{fig:test-sub-2}\quad\subref{fig:test-sub-2}\par
\ref{fig:test}
\end{document}
Related Question