The PNG image of a TikZ picture that is generated by the standalone document class has the wrong dimensions
Conceptually bitmaps do not have a size, they just have a number of pixels. As documented in the standalone
manual the class tells convert
to assume 300dpi which makes a high resolution image for print, but the default image resolution for pdftex is 72dpi, in fact png files can store an intended size for their pixels but most don't and even if they do not all systems use the hint.
so either of
\fbox{\includegraphics[scale=.24]{file.png}}% 72/300=.24
or
{\pdfimageresolution=300 \fbox{\includegraphics{file.png}}}
will be the same size as
\fbox{\includegraphics{file.pdf}}
No. It does not. It depends how you measure it.
Measuring in MS Word:
Three different resolution images placed in Word:
When printed:
Measuring in LaTeX:
The Code:
\documentclass[]{standalone}
\usepackage{graphics}
\begin{document}
\noindent
\includegraphics{aaa.pdf}
\includegraphics{aaa.png}
\end{document}
Measurement on the screen with 100% zoom of the PDF viewer:
Measurement on Web Page:
You cannot rely on the size of the PNG that you see on a web browser as they process images differently (see here)
JPEG Image with 1200 dpi Uploaded to Imgur and seen through a web browser:
PNG Image with 300 dpi Uploaded to Imgur and seen through a web browser:
JPEG Image with 50 dpi Uploaded to Imgur and seen through a web browser:
If you want to see the correct dimension on your web browser, you need to generate your PNG with the correct dpi. See the following exercise:
My screen is 2560x1440.
Horizontal dimension of screen is: appr 23.5 inches
Screen resolution is 2560 dots/23.5 inches = 109 dots per inch
I generated a PNG with a dpi of approximately 110.
I measure the horizontal dimension on the screen with a web browser:
The standalone
user manual (v1.2 - 2015/07/15) explains why the generated PNG image doesn't have the expected physical dimensions, and also gives methods to set these dimensions properly.
Why the PNG image has the wrong physical dimensions
According to section 4.6.1 'Conversion settings' on p. 15
the following default settings are used: [...] a density of 300dpi
'dpi' is short for 'dot per inch', a.k.a. 'pixels per inch' ('ppi'). To have the correct dimensions when displayed on your screen, the ppi used to generate the PNG must equal your screen's ppi.
To find out your screen's ppi, follow this simple method given on Wikipedia's Pixel density page. The method consists of using a ruler held to the screen to measure the length of a line known to be made up of a certain number of pixels.
How to ensure the PNG image has the correct physical dimensions
Table 1 on p. 17 suggests two methods to ensure the generated PNG image have the desired physical dimensions. Both methods consist of assigning a value to the convert
document class option, as follows:
\documentclass[tikz,convert={...}]{standalone}
Set
convert={density=<d>}
, where<d>
is your screen's ppi.Set
convert={size=<w>x<h>}
, where<w>x<h>
is the pixel dimensions of a PNG image known to have the desired physical dimensions when displayed on your screen.In the present case, since you stated that the screenshot of the PDF picture had the correct physical dimensions, use its pixel dimensions, namely 137x50. If you use macOS, these can be read directly from Finder.