[Tex/LaTex] Horizontally and vertically center a figure and scale to fill the whole page in landspape orientation

floatshorizontal alignmentlandscapepdftexscaling

I want to have an image that fills a landscape page.

I have tried:

\documentclass[a4paper]{report}

\usepackage[utf8]{inputenc}
\usepackage{pdflscape} %Gives us landscape pages with begin{landscape}. Use this for pages with very large diagrams.
\usepackage{geometry} %change margin on individual page \newgeometry{} and \restoreometry
\usepackage{graphicx}
\usepackage{caption} %nicer captions
\usepackage{float}%exact placement of floats (things inside a begin{})

\usepackage{todonotes}  %For the minium working example

\begin{document}

\listoffigures

\begin{landscape}

  \newgeometry{left=1cm,right=1cm,top=1cm,bottom=1cm}
  \thispagestyle{empty} %disable page numbering for this page

    \vfill
      \begin{center}
        \begin{figure}
          \missingfigure[figwidth = \paperwidth]{picture}
          \label{label32}
          \caption{a big image}
        \end{figure}
      \end{center}
    \vfill

  \restoregeometry
\end{landscape}

\end{document}

But this places the image in the top right corner of the landscape page, and its not even scaled that big. If I use \centering inside the figure environment instead of creating a center environment, the figure is then put in the bottom corner.

How can I place it so that it is horizontally and vertically centered, and it fills the page, with about a 1 or 2 cm margin?

These requirements are all flexible if you have a better suggestion. My main goal is to display an image with lots of fine detail, only visible when it scaled up to just less than A4 size.

I am using the pdflatex compiler, and hence I am using the pdflscape package. My document type is a report, and cannot be changed.

Preview:

enter image description here

Best Answer

Building on Gustavo Mezzetti's answer, the image can be placed in a figure environment so it can be captioned and listed in the \listoffigures. A few other modifications are required, shown below.

The \paperheight adjustment (-6cm) needs to be manually tuned depending on the aspect ratio of your image. This is best done by eye anyway, as an automatic process wouldn't know what looks best.

\documentclass[a4paper]{report}

\usepackage[utf8]{inputenc}
\usepackage{pdflscape} %Gives us landscape pages with begin{landscape}. Use this for pages with very large diagrams.
\usepackage{geometry} %change margin on individual page \newgeometry{} and \restoreometry
\usepackage{graphicx}
\usepackage{caption} %nicer captions
\usepackage{float}%exact placement of floats (things inside a begin{})
\usepackage{mwe}


\begin{document}

\listoffigures

\newgeometry{left=1cm,right=1cm,top=1cm,bottom=1cm}

\begin{landscape}
  \thispagestyle{empty} %disable page numbering for this page
        \begin{figure}
           \centering
           \includegraphics [width=\dimexpr\paperheight-6cm\relax]{image}
          \label{label32}
          \caption{a big image}
        \end{figure}
\end{landscape}

\restoregeometry

\end{document}

Preview:

enter image description here

Addition:

Here it is as a command. Put this in the document preamble:

%Command to insert a landscape page filled with a centred figure.
%The arguments are: {marginsize}{tunable parameter to adjust for aspect ratio}{caption}{imagepath}
%Example usage: \hFigure{1cm}{2cm}{This is a big image}{pics/myImage.png}
\newcommand{\hFigure}[4]{
\newgeometry{left=#1,right=#1,top=#1,bottom=#1}
\begin{landscape}
  \thispagestyle{empty} %disable page numbering for this page
\vfill
        \begin{figure}
           \centering
           \includegraphics [width=\dimexpr\paperheight-#2\relax]{#4}
          \label{label32}
          \caption{#3}
        \end{figure}
\vfill
\end{landscape}
\restoregeometry
}
Related Question