I have two images with size of 1920 by 1280 and 561 by 422. I want to include them in a figure. But due to different sizes, the resulting figure is not looking good.
MWE:
\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure*}[!t]
\centering
\subfloat[]{\includegraphics[width=0.45\textwidth]{Results/image_10.jpg}%
\label{fig_msg_img}}
\hfil
\subfloat[]{\includegraphics[width=0.45\textwidth]{Results/Untouched_Frame_351.png}
\label{fig_frame_351}}
\caption{\protect\subref{fig_msg_img} The message image and \protect\subref{fig_frame_351} a frame from the video.}
\label{fig:my_label}
\end{figure*}
\end{document}
Output:
I want the images to have the same height. So, I tried to get the desired result by stating a constant height like this \includegraphics[height=2in]{Results/image_10.jpg}
for both images. But yet the result was not as expected. The output was
How may I get the figure having both the images the same size (maintaining aspect ratio is not necessary)?
The images can be found here: https://i.stack.imgur.com/lYGeL.jpg and https://i.stack.imgur.com/NCJGW.jpg
Best Answer
The issue you've encountered has nothing to do with LaTeX per se. Instead, it's caused by the second image file coming with a considerable white "frame" around the actual image.
I suggest you use a suitable graphics tool to remove the frame. Once you do that, you'll end up getting something like the following. (Since your document has two main columns on each page, I would also like to recommend that you choose
width=\columnwidth
rather thanwidth=0.45\textwidth
.)If, in addition, you could get the aspect ratios of the two images to be the same, I'd definitely pursue that route as well.