按原样插入 PNG 文件

按原样插入 PNG 文件

我正在插入一个 PNG 文件,但它不知何故被放大了。这是我的 MWE:

\documentclass{book}
\usepackage{graphicx}
\begin{document}
\mainmatter
hello, world.
the following screenshot should be rendered in 1:1 scale, isn't it?

\begin{figure}[H]
\centering
\includegraphics{screenshot.png}
\end{figure}

\end{document}

这是我想要插入的屏幕截图:http://conus.info/tmp/screenshot.png 我使用 XeLaTeX。

结果如下:http://conus.info/tmp/result.pdf

我想要的只是插入一张 PNG 图片(屏幕截图),这样它将在以 100% 比例查看的 PDF 中以相同的宽度/高度呈现。

的尺寸screenshot.png是 726 像素 x 489 像素。我希望它在 Acrobat Reader 中以 100% 的比例查看时大小完全相同。

我应该怎么办?

将截图插入 TeX 并将其导出为 PDF 的最佳做法是什么?

答案1

这个问题无法为所有监视器提供通用的答案。

屏幕上的 PNG 图像的大小取决于屏幕分辨率(例如,我的 MacBook 为 110.27 PPI(每英寸像素数)),而在 Retina(220 PPI)上,它会小一半。

PDF 内部图像的尺寸以真实的 100% 显示,与显示器无关。

因此我的显示器的解决方案是:

\includegraphics[scale=0.65]{screenshot.png}

与您的不同:

\includegraphics[scale=0.75]{screenshot.png}

答案2

\documentclass{book}

\usepackage{graphicx}

\begin{document}
    \mainmatter

    \begin{figure}[H]
        \centering
        \includegraphics[height = 0.3, width = 0.6]{crocodile.png}
    \end{figure}

\end{document}

相关内容