[Tex/LaTex] How to fit a large figure to page

calculationsgraphicsscaling

Possible Duplicate:
Best figure size adjustment when dealing with different image sizes

Given: a large figure, whose height:width ratio is unknown.
Todo: Include this fig in LaTeX, such that:

  • if the figure is very tall, then fit its height to page
  • if the figure is very wide, then fit its width to page

How to do it?

Or in other words, is there way for LaTeX to get (or compare) the width and length of a figure?

Best Answer

How about

\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{myfig.png}
Related Question