The JPEG file example-image-a.jpg does have resolution information:
Image file name = example-image-a.jpg * File [example-image-a.jpg] ( FP-DIV ) ( FP-DIV ) Type: jpg Pixel width: 400 px Pixel height: 300 px Density x: 90 dots per 72.27pt Density y: 90 dots per 72.27pt Width: 319.99911 bp Height: 239.99905 bp
The density lines mean: 90 DPI
The PNG file lacks information about resolution:
Image file name = example-image-a.png * File [example-image-a.png] ( FP-DIV ) ( FP-MUL ) ( FP-DIV ) ( FP-DIV ) Type: png Pixel width: 400 px Pixel height: 300 px Ratio x: 90 Ratio y: 90 Width: 399.99916 bp Height: 299.99965 bp
Therefore, a default resolution of 72 DPI is used.
The data are extracted with:
pdftex bmpsize-test
Setting of the default resolution
In case of pdfTeX, the default resolution can be set via \pdfimageresolution. This resolution is used, if pdfTeX cannot find resolution data in the bitmap file. The graphics driver file pdftex.def supports the setting of this resolution by option resolution:
\documentclass{article} \usepackage{graphicx} \begin{document} \noindent \includegraphics{example-image-a.jpg} \noindent \includegraphics[resolution=90]{example-image-a.png} \end{document}

Extracting resolution data (pdfTeX)
The resolution data can also be extracted from example-image-a.jpg and used for example-image-a.png via the help of package bmpsize-base.
\documentclass{article} \usepackage{graphicx} \usepackage{bmpsize-base} \makeatletter % Macro \SetMacroToImageResolution{#1}{#2} % #1: macro that gets the rounded DPI integer value as result % #2: image file with extension % Result: Macro #1 is defined with the % rounded image resolution in DPI as integer % or 0 if the image is not found % or the resolution data are not complete. \newcommand*{\SetMacroToImageResolutionX}[2]{% \begingroup \let\@ImageResolutionX\relax % Try the supported image formats for pdfTeX in PDF mode % until the correct image format is detected \@tfor\x:={jpg}{png}\do{% \expandafter\@TryGetImageResolutionX\expandafter{\x}{#2}% \ifx\@ImageResolutionX\relax \else \@break@tfor \fi }% \edef\x{\endgroup \def\noexpand#1{\@ImageResolutionX}% }\x } \newcommand*{\@TryGetImageResolutionX}[2]{% \csname bmpsize@read@#1\endcsname{#2}% \ifbmpsize@ok % Image could be read \def\@ImageResolutionX{-1}% % Test for complete resolution data \ifx\bmpsize@unit\relax \else \ifx\bmpsize@pixelx\relax \else % Resolution data present \edef\x{\strip@pt\dimexpr\bmpsize@unit}% \FPset{\x}{\x}% \FPmul{\x}{\x}{\bmpsize@pixelx}% \FPdiv{\x}{\x}{72.27}% \FPround{\x}{\x}{0}% \let\@ImageResolutionX\x \fi \fi \fi } \makeatother \begin{document} \noindent \includegraphics{example-image-a.jpg} \SetMacroToImageResolutionX\ImageResolution{example-image-a.jpg} \noindent \includegraphics[resolution=\ImageResolution]{example-image-a.png} \end{document}