Your specifications are somewhat vague, so I may have taken some liberties in interpreting what you wanted to do.
For those who are not familiar with your earlier question, I should point out here that you requested and I introduced the concept of a "row-figure" which is constructed of various sized subfigures, all of which are to be scaled (with aspect ratio preserved) in such a way as to occupy an overall width specified by the user (default \textwidth).
I have introduced the following commands that work inside an environment:
\rowfigurewidth{specified width of row-figure} - which defaults to \textwidth
\startrowfigure[starting subfig number]{left-most image to store in the new row-figure}
\addrowfigure{figure to store at current right-end of row-figure}
\presentrowfigure - regurgitates the currently constructed row figure
\showrowfigure{}{}{}{} - the macro that formats each subfigure component of the row-figure (not called by user, but determines format of presented row-figure)
rowfigcount is the counter that contains the current value of subfigs employed, if one wishes continue on a subsequent line (via \therowfigcount as optional argument to \startrowfigure.
Sample usage would be:
\begin{figure}[ht] \startrowfigure{\figa} \addrowfigure{\figb} \addrowfigure{\figc} \addrowfigure{\figd} \presentrowfigure \end{figure}
And the whole code is given below:
\documentclass{article} \usepackage{scalerel} \usepackage{fp} \usepackage{stackengine} \def\stacktype{L} \usepackage{xcolor} \newcount\figwidthc \newcount\textwidthc \newcounter{rowfigcount} \newcounter{rowfigindex} \newsavebox\compositefig \newlength\rowfigwidth \def\rowfigwidthstring{\textwidth} \newcommand\rowfigurewidth[1]{\edef\rowfigwidthstring{#1}} \newcommand\startrowfigure[2][0]{% \sbox\compositefig{#2}% \edef\rowfigstart{#1}% \setcounter{rowfigcount}{#1}% \addtocounter{rowfigcount}{1}% \expandafter\def\csname rowfig\roman{rowfigcount}\endcsname{#2}% } \newcommand\addrowfigure[1]{% \sbox\compositefig{\scalerel{\usebox{\compositefig}}{$#1$}}% \addtocounter{rowfigcount}{1}% \expandafter\def\csname rowfig\roman{rowfigcount}\endcsname{#1}% } \newcommand\presentrowfigure{% \figwidthc=\wd\compositefig% \setlength{\rowfigwidth}{\rowfigwidthstring}% \textwidthc=\rowfigwidth% \FPdiv\scaleratio{\the\textwidthc}{\the\figwidthc}% \setcounter{rowfigindex}{\rowfigstart}% \whiledo{\value{rowfigindex} < \value{rowfigcount}}{% \stepcounter{rowfigindex}% \showrowfigure% {\scaleratio}% {\alph{rowfigindex}}% {\csname rowfig\roman{rowfigindex}\endcsname}% {\csname rowfig\roman{rowfigcount}\endcsname}% } } \newcommand\showrowfigure[4]{% \stackunder{\scalebox{#1}{\scalerel*{$#3$}{$#4$}}}{(#2)}% } \begin{document} \def\figa{\color{blue}\rule{.5in}{.7in}} \def\figb{\color{red}\rule{.7in}{.3in}} \def\figc{\color{green}\rule{.4in}{.5in}} \def\figd{\color{black}\rule{1.in}{.8in}} \def\fige{\color{red}\rule{1.5in}{.7in}} \def\figf{\color{cyan}\rule{1.7in}{1.3in}} \def\figg{\color{magenta}\rule{1.4in}{1.5in}} \def\figh{\color{black}\rule{1.in}{.8in}} Here I demonstrate row figures: \begin{figure}[ht] \startrowfigure{\figa} \addrowfigure{\figb} \addrowfigure{\figc} \addrowfigure{\figd} \presentrowfigure \\ \vspace{1em}\\ \rowfigurewidth{.8\textwidth} \startrowfigure[\therowfigcount]{\fige} \addrowfigure{\figf} \addrowfigure{\figg} \addrowfigure{\figh} \presentrowfigure \caption{These are my row figures} \end{figure} which came from these raw images: \begin{figure}[ht] \figa\figb\figc\figd \\ \vspace{1em}\\ \fige\figf\figg\figh \caption{These are the unaltered images} \end{figure} \end{document}

Obviously, if you wanted to do something more than just put a (subfig number) below the individual images, you would have to pass it to \startrowfig and \addrowfig, store it, and recall it via an entry in \showrowfigure