\documentclass{article}
\usepackage{graphicx}
\usepackage{fitbox}
\usepackage{subfig}
\begin{document}

The use of fitbox with a subfigure.  Note that the optional argument
for the command counts the lines for the subcaptions.  

\SetFitboxLayout[subcaplines=1]{3}{2}




\begin{figure}
  \centering
  \subfloat[First
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Second
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\\
  \subfloat[Third
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Fourth
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\\
  \subfloat[Fifth
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Sixth
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}
  \caption{Six Napoleons, \texttt{\textbackslash SetFitboxLayout[subcaplines=1]\{3\}\{2\}}}
  \label{fig:napoleons}
\end{figure}

\SetFitboxLayout{3}{2}

\begin{figure}
  \centering
  \subfloat{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat{\fitbox*{\includegraphics{napoleon}}}\\
  \subfloat{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat{\fitbox*{\includegraphics{napoleon}}}\\
  \subfloat{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat{\fitbox*{\includegraphics{napoleon}}}
  \caption{Six Napoleons, no subcaptions, \texttt{\textbackslash SetFitboxLayout\{3\}\{2\}}}
  \label{fig:napoleons1}
\end{figure}

\SetFitboxLayout[subcaplines=1, maincaplines=2]{2}{3}




\begin{figure}
  \centering
  \subfloat[First
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Second
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Third
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\\
  \subfloat[Fourth
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Fifth
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
  \subfloat[Sixth
  Napoleon]{\fitbox*{\includegraphics{napoleon}}}
  \caption{Six Napoleons, another arrangement\\
    \texttt{\textbackslash SetFitboxLayout[subcaplines=1,
      maincaplines=2]\{2\}\{3\}}} 
  \label{fig:napoleons3}
\end{figure}


\end{document}
