# Including figures; how to determine compiler

I need to prepare a PDF and PS file from the same latex source but got stuck on including figures. When using `pdflatex` I can insert a png file like:

``````\includegraphics[scale=0.6]{figure.png}
``````

However, this does not work when producing the PS file. To produce PS I need to set the bounding box and set the scale differently. For the same figure my code looks like this:

``````\includegraphics[scale=0.073,bb=0 0 2200 1510]{figure.png}
``````

Now I'd like to switch between these two versions depending on the output I want to produce: PS or PDF. Is there any way to determine the output automatically so I can use a conditional clause like `ifthenelse` to switch between the commands?

Do you know any easier way to include png files in PS and PDF?

-
There's an `ifpdf` package, but how are you including a png when producing postscript? –  TH. Aug 16 '11 at 12:24
I use MiKTeX; it just works. And `ifpdf` does the trick! Thanks. –  Jacek Aug 16 '11 at 12:31

do not use an extension, nearly all drivers can detect the mode automatically and will then use the image depending to the used command `pdflatex` or `latex`. The mode can be detected inside a document with:

``````\usepackage{ifpdf}

\ifpdf
do something pdf specific
\else
do something non-pdf specific
\fi
``````
-
But this does not solve the issue and also when not using the extension `latex` complains it can't find file 'figure'... –  Jacek Aug 16 '11 at 12:21
for `latex` you need an `eps` version of the figure –  Herbert Aug 16 '11 at 12:39