Align figures to top using minipage environment

You have two ways: one with minipages, one without them.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=1.5cm,bottom=1.5cm]{geometry}

\begin{document}

\noindent X\dotfill X % for seeing the line width

\begin{figure}[htp]

\hspace*{\fill}%
\begin{minipage}[t]{0.25\textwidth}
\centering
\vspace{0pt}
\includegraphics[width=\textwidth]{example-image-a}
\end{minipage}%
\hfill
\begin{minipage}[t]{0.45\textwidth}
\centering
\vspace{0pt}
\includegraphics[width=\textwidth]{example-image-b}
\end{minipage}%
\hspace*{\fill}

\end{figure} 

\begin{figure}[htp]

\hspace*{\fill}%
\raisebox{-\height}{\includegraphics[width=0.25\textwidth]{example-image-a}}%
\hfill
\raisebox{-\height}{\includegraphics[width=0.45\textwidth]{example-image-b}}%
\hspace*{\fill}

\end{figure} 

\end{document}

enter image description here

The addition of \vspace{0pt} sets an invisible item at the top of the minipage, which becomes the the reference point.

The second solution exploits the fact that the reference point of an image is the bottom left, so raising it by -\height pushes it down so the reference point is the upper left.

Note the % to avoid spurious spaces. You're adding too many of them.


You can take advantage of graphbox package which load graphicx and add key align to modify vertical alignment of image, in your case you need align=t for both.

\documentclass[8pt,a4paper,dvipsnames]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphbox}
\usepackage[left=2cm,right=2cm,top=1.5cm,bottom=1.5cm]{geometry}


\begin{document}
Test text
\begin{figure}[htp]
{\hfill}
\begin{minipage}[t]{0.35\textwidth}
\centering
\includegraphics[width=3cm,align=t]{example-image-a}
\end{minipage}
{\hfill}
\begin{minipage}[t]{0.55\textwidth}
\centering
\includegraphics[width=5cm,align=t]{example-image-b}
\end{minipage}
{\hfill}
\end{figure} 

\end{document}