# PDF and PNG different in size

When I use different types of pictures (png and pdf) although defining them with same size, I get different sizes as can be seen in the following . Here are the packages and code I use:

\begin{figure}
\hfill
\subfigure[J8]{\includegraphics[width=7.5cm]{Figure32Graph28c.png}}
\hfill
\subfigure[CT]{\includegraphics[width=7.5cm]{Figure32Graph28d.png}}
\hfill
\subfigure[J]{\includegraphics[width=7.5cm]{Figure32Graph28f.pdf}}
\hfill
\subfigure[CT]{\includegraphics[width=7.5cm]{Figure32Graph28e.pdf}}
\hfill
\caption{Accuracy Results }
\label{fig:DS3}
\end{figure}


And here are the packages etc:

\begin{filecontents*}{example.eps}
%%BoundingBox: 19 19 221 221
%%CreationDate: Mon Sep 29 1997
%%Creator: programmed by hand (JK)
gsave
newpath
20 20 moveto
20 220 lineto
220 220 lineto
220 20 lineto
closepath
2 setlinewidth
gsave
.4 setgray fill
grestore
stroke
grestore
\end{filecontents*}
%
\RequirePackage{fix-cm}
%
%\documentclass{svjour3}                     % onecolumn (standard format)
%\documentclass[smallcondensed]{svjour3}     % onecolumn (ditto)
\documentclass[smallextended]{svjour3}       % onecolumn (second format)
%\documentclass[twocolumn]{svjour3}          % twocolumn
%\smartqed  % flush right qed marks, e.g. at end of proof
%
%\usepackage{graphicx}
%
% \usepackage{mathptmx}      % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
% etc.
%

% \documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{authblk}
\usepackage{textcomp}
\usepackage{mathtools}
\usepackage{filecontents}
\usepackage{microtype}
\usepackage{float}
\usepackage{booktabs,makecell,tabularx}
\usepackage{url}
\usepackage{booktabs}
\usepackage{subfigure}

\newcommand{\tvar}[2]{%
\mathrm{#1}_{\mathrm{#2}}%
}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}

%\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{etoolbox}
\usepackage{tabularx, booktabs, makecell} %

%\\usepackage[symbol*]{footmisc}
%\usepackage[round]{natbib}
\usepackage[square,numbers]{natbib}
\renewcommand{\thetable}{\arabic{table}}

%\usepackage{siunitx,etoolbox}
%\renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
%\renewrobustcmd{\boldmath}{}
%\newrobustcmd{\B}{\bfseries}

\usepackage{lmodern}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{etoolbox}

% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%

\usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
\begin{document}
... // insert the above code here!!!!
\end{document}


Here is the results of \fbox:

\fbox{\includegraphics[width=7.5cm]{Figure32Graph28e.pdf}}


• Most likely the pdf pictures have a white border. Did you check that they have not? – user121799 Aug 27 '18 at 13:03
• Can you please explain me how to check it? I produce the PDF from excel same as the PNG. – Avi Aug 27 '18 at 13:08
• for example with \fbox: \fbox{includegraphics[width=7.5cm]{Figure32Graph28e.pdf}} and see how much white space is between frame and imge. – Zarko Aug 27 '18 at 13:09
• Can you please elaborate how can I fix it? – Avi Aug 27 '18 at 13:10
• @Avi, you have many options: (i) see if you can export images without white space, (ii) by some image tool remove white space, (iii) use trim function as suggest @marmot, or (iv) redraw images with some \latext package, for example with pgfplots (to my opinion this would give the best result). at trimming is usual used method trial and error ... – Zarko Aug 27 '18 at 15:14