beamer includegraphics with screenshots
Asked Answered
D

4

12

I'm using the LaTeX-Beamer class for making presentations. Every once in a while I need to include screenshots. Those graphics are pixel-based, of course. I use includegraphics like this:

\begin{figure}
   \includegraphics[width= \paperwidth]{img/analyzer.png}
\end{figure}

or usually something like this:

\begin{figure}
   \includegraphics[width= 0.8\linewidth]{img/analyzer.png}
\end{figure}

This leads to pretty bad readibility of the contained text, so I'm asking for your best practices: How would you include screenshots containing text considering, that I will do the output PDF with pdflatex?

EDIT: I suppose I'm looking for something like an 1:1 presetation of the image within beamer. However, [scale = 1.0] doesn't achieve what I'm looking for.

Donnelly answered 7/1, 2010 at 22:3 Comment(2)
Just for reference it has been answered at [tex stackexchange][1] [1]: tex.stackexchange.com/questions/11954/…Diggs
Thank you for coming back and sharing. keepaspectratio seems to be the key here.Donnelly
P
7

Your best bet is to scale the image outside of Latex for inclusion, and include it in 1:1 ratio. The scaling done by graphics packages in Latex isn't going to be anywhere near as good as possible from other tools. Latex (Tex) has limited floating-point arithmetic capabilities, whereas an external tool can use sophisticated algorithms to get the scaling better.

Another option is to use only a part of the screenshot, the one you want to concentrate on.

Edit: If you can change the font size before taking the screenshot, that's another option—just increase the font size for the screenshots.

Of course, you can combine the two methods.

Pontone answered 8/1, 2010 at 1:37 Comment(4)
makes sense, but how do I determine, what the size has to be for the 1:1 ratio? If I try images around 800x600 and just pass them in, I only get to see a scaled version, which only shows the upper left corner of the image..Donnelly
The only solution I can see is to put something like: \message{width = \the\textwidth} in your document, and see what the current text width, w, is (it should be in points, which is 1/72.27 inches). Then, if your PDF is n dpi in resolution, you need w*n/72.27 pixels wide image.Pontone
I can't seem how to do this, as I need to decrease the resolution of the image, which means that the text would be ultimately unreadable. The unscaled image takes more than the entire slide of the beamer presentation (I see only the upper left corner of the image), and the only option is to resize my 800x600 screenshot to something like 200x300. What does the answer mean by increasing the "font size", and which method of increasing font size should be used?Orthoscope
It's been a while, if I'm not mistaken, the font size was the one of a potential text editor the screenshot was taken of. The idea was simply to increase the font size of the editor to achieve more readibility in the resulting screenshot (even if it was scaled). Also notice, that I was using LaTeX Beamer on Linux back then and the choice of the pdf viewer had an impact on the image quality shown.Donnelly
C
5

I have done exactly what you do and e.g defined

\newcommand{\screenshot}[1]{\centerline{%
    \includegraphics[height=7.8cm,transparent]{#1}}}  % 7.8in

which worked with whatever style I was using at the time. The files included with this macro were all PNGs created with one the usual Linux screen capture tools.

Edit: You may have to play with the size (height and width) of your input files. It came out rather nice for me (and this was from a presentation in 2006).

Coinstantaneous answered 7/1, 2010 at 22:31 Comment(1)
What does transparent parameter do?Cadency
S
3

How about scaling it as follows:

\includegraphics[scale=0.5]{images/myimage.jpg}

This works for me.

Superdominant answered 2/11, 2011 at 18:34 Comment(1)
Thanks for contributing. scale didn't work for my issue, but see the proposed answer in the comment section of the question, there's been a solution over at the TeX Stack Exchange site.Donnelly
C
2

Have you tried to convert the image to .eps or .pdf file and use this file in LaTeX?

Maybe try also latex, dvips and ps2pdf.

Problem might be in used viewer, in Linux I use Document viewer or ePDFViewer and output is much worse than in Adobe Reader or Acrobat, which I use in Windows...

Cadency answered 7/1, 2010 at 22:25 Comment(1)
But the viewer seems to be an issue, looks a lot better in Acrobat Reader on Windows.Donnelly

© 2022 - 2024 — McMap. All rights reserved.