How to vertically center two images next to each other?

The baseline of images is at their bottom. You could change that by using \raisebox. For example:

\documentclass{article}
\usepackage[textwidth=6in]{geometry}
\usepackage[demo]{graphicx}
\begin{document}
\noindent
\begin{minipage}{6in}
  \centering
  \raisebox{-0.5\height}{\includegraphics[height=1.25in]{fig1.pdf}}
  \hspace*{.2in}
  \raisebox{-0.5\height}{\includegraphics[height=1in]{fig2.pdf}}
\end{minipage}
\end{document}

Gives vertically centered images, here black rectangles because of the demo option:

alt text

Raising their baseline by .5\height has the nice effect that also following text would be aligned at the new baseline at the vertical center.

Alternatively, you could use \vcenter, which is working fine as well:

\begin{minipage}{6in}
  \centering
  $\vcenter{\hbox{\includegraphics[height=2.25in]{fig1.pdf}}}$
  \hspace*{.2in}
  $\vcenter{\hbox{\includegraphics[height=1in]{fig2.pdf}}}$
  following text
\end{minipage}

Note: \vcenter requires mathmode. \hbox for the argument may be necessary too.


The graphbox package adds an "align" option to the \includegraphics command that makes this very easy:

\usepackage{graphicx}
\usepackage{graphbox}
[...]

\begin{minipage}{6in}
  \centering
  \includegraphics[align=c,height=1.25in]{fig1.pdf}
  \hspace*{.2in}
  \includegraphics[align=c,height=1in]{fig2.pdf}
\end{minipage}

Just use \parboxes. Let's say we want two include the two jpg files: first picture and second picture The following code does it:

\documentclass{article}
\usepackage{graphicx}

%% first attempt (but needs modifications in case of optional parameters to \includegraphics)

\newcommand{\vcenteredinclude}[1]{\begingroup
\setbox0=\hbox{\includegraphics{#1}}%
\parbox{\wd0}{\box0}\endgroup}

%% better: (general command to vertically center horizontal material)
\newcommand*{\vcenteredhbox}[1]{\begingroup
\setbox0=\hbox{#1}\parbox{\wd0}{\box0}\endgroup}

\begin{document}

How can I vertically center two images next to one another? I want the center
line of both images to be at the same height.

\vcenteredhbox{\includegraphics{figure1.jpg}} and
\vcenteredhbox{\includegraphics{figure2.jpg}} and \vcenteredhbox{\LARGE This too
is vertically centered}

\end{document}

The result of the pdflatex compilation is: outcome of pdftex run