\includegraphicsを使用して画像ごとにDPIを明示的に設定できますか?

\includegraphicsを使用して画像ごとにDPIを明示的に設定できますか?

ドキュメントに含めたい画像\includegraphics(または類似のもの)がいくつかあります。

問題は、特定の画像の DPI をケースバイケースで明示的に上書きしたいということです。

つまり、次のようなことをしたいのです。

\newcommand{\smalldpi}{100}
\newcommand{\largedpi}{600}

\includegraphics{foo.png}% default DPI seems to be fine for this one
\includeapicture[dpi=\smalldpi]{bar.png}
\includeapicture[dpi=\largedpi]{baz.png}

このドキュメントDPIについては全く言及されていないようです。

ピクセル寸法と指定された DPI から画像の物理的なサイズを決定するにはどうすればよいでしょうか?

答え1

ソリューションpdfTeX原始的で大きい:

前文では次のように述べられています。

\newcommand{\includegraphicsdpi}[3]{
    \pdfimageresolution=#1  % Change the dpi of images
    \includegraphics[#2]{#3}
    \pdfimageresolution=72  % Change it back to the default
}

文書内:

\includegraphicsdpi{300}{}{figures/rpi/app_main}

以前の解決策: 私は以前、Texlive 2016を使用して、まさにこれを実行していました。おそらく、それがうまくいくでしょう。最近Texliveを更新したら、動作しなくなりました。それについては別の質問\includegraphics[resolution=300]{bar.png}があります。Package keyval Error: resolution undefined.ここ

関連情報