[Tex/LaTex] Including large images in landscape formatting

formattinggraphicslandscapemargins

I'm having issues including large images in landscape mode

This is about as large as the image will render

Changing the size makes the orientation switch

Ideally I'd like to be able to have a large image on this landscape page, that's the reason that I've made the page landscape.

Also, it's important that the page within the pdf is rotated 90 degrees (which is currently the case), so that when reading the document on a screen I don't have to tilt my head to view landscape pages. I would like to retain that in any solution please.

Here's the example code

\documentclass{article}
\usepackage[margin=1.0in]{geometry}

% so that i can crop images
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}
\usepackage{pdflscape}
\usepackage{showframe}
\usepackage[paper=portrait,pagesize]{typearea}


% this is needed for positioning images
\usepackage{float}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Save the image from this link : https://i.imgur.com/CN1gsF4.png
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Required this package for including graphics and landscaping
% \usepackage[paper=portrait,pagesize]{typearea}
% Link to the stack post
% https://tex.stackexchange.com/a/430619/69118

%%%%%%%%%%%%%%%%
% IMAGE TEST ONE
%%%%%%%%%%%%%%%%

\clearpage
\newpage
% Probably don't want the header for this page, so suppress it
% \thispagestyle{plain}
\thispagestyle{empty}
\newgeometry{left=1cm,bottom=0.1cm}
\KOMAoptions{paper=landscape,pagesize}
\recalctypearea
\begin{figure}[ht]
    \fbox{%
     \includegraphics[width=0.7\textwidth]{test.png}
    }
\end{figure}
\newpage
\KOMAoptions{paper=portrait,pagesize}
\recalctypearea
\restoregeometry
\cleardoublepage

\end{document}

For when / if the image stops being hosted here's it's size :

file image-testing.png 
image-testing.png: PNG image data, 1600 x 1200, 8-bit/color RGBA, non-interlaced

Edit – code for zarko

\documentclass{article}

\usepackage[margin=1.0in,bottom=1.0in]{geometry}

% so that i can crop images
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage{epstopdf}
\usepackage{pdflscape}


% this is needed for positioning images
\usepackage{float}
\usepackage{lipsum}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Save the image from this link : https://i.imgur.com/CN1gsF4.png
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Required this package for including graphics and landscaping
% \usepackage[paper=portrait,pagesize]{typearea}
% Link to the stack post
% https://tex.stackexchange.com/a/430619/69118

%%%%%%%%%%%%%%%%
% IMAGE TEST ONE
%%%%%%%%%%%%%%%%

\clearpage
\newpage

\thispagestyle{empty}
\begin{landscape}
    \centering
\thispagestyle{empty}
\begin{figure}%[htb]
     \includegraphics[width=\linewidth]{test.png}
    \caption{This is some caption text that I'm using to see what this looks like with caption text. I'm not too sure about 
    adding text in the landscape environment, as I }
\end{figure}
\end{landscape}


\end{document}

Best Answer

  • showframe in document with some page in landscape environment doesn't show correct page borders for landscape pages
  • in landscape page you should for image width use \linewidth since \textwidth is not changed
  • please use just one package for landscape orientation, not both: lscape and pdflscape (both will give in printed document the same result, but on screen pdflcsape rotate landscape page for simpler view of it content)

the following mwe, in which i omit all packages not relevant to your problem.

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage{pdflscape}

\usepackage{showframe}
\usepackage{lipsum}

\begin{document}
\thispagestyle{empty}
\lipsum[1]
\begin{landscape}
\noindent%
XXX \hfill XXX % for show width of text area
\begin{figure}[htb]
\fbox{
     \includegraphics[width=\dimexpr\linewidth-4\fboxsep-2\fboxrule]{test.png}
     }
\end{figure}
\end{landscape}
\lipsum[2]
\end{document}

gives

enter image description here

addendum: now with caption and example image (instead it you should use your image) and removed stuff which in previous solution show size of text area.

\documentclass{article}
\usepackage{geometry}% added  nut it not influence on solution

\usepackage{graphicx}
\usepackage{pdflscape}

\usepackage{lipsum}

\begin{document}
\thispagestyle{empty}
\lipsum[1]
\begin{landscape}
    \begin{figure}[htb]
\includegraphics[width=\linewidth]{example-image-duck}% example image provided by "graphicx"
\caption{This is some caption text that I'm using to see what this looks like with caption text. I'm not too sure about adding text in the landscape environment, as I use in my real document ... sorry, i can use image provided by you in \texttt{igmur}.}
\label{fig:landscape}
    \end{figure}
\end{landscape}
\lipsum[2]
\end{document}

enter image description here

as you can see,image is centered in text area. since now fbox is removed, the width of image is determined only by \linewidth

Related Question