How can I insert a full page image? No blank space left in the page.
Bonus: How can I add some text over the image?
Using background
package:
\documentclass{article}
\usepackage{lipsum} %% gives dummy text for this file
\usepackage{background}
\backgroundsetup{
scale=1,
angle=0,
opacity=.4, %% adjust
contents={\includegraphics[width=\paperwidth,height=\paperheight]{pgfmanual}}
}
\begin{document}
\lipsum
\end{document}
Use keepaspectratio
as the option to \includegraphics
if you wish.
Using eso-pic
:
\documentclass{article}
\usepackage{lipsum} %% gives dummy text for this file
\usepackage{eso-pic,graphicx}
\AddToShipoutPictureBG{%
\AtPageLowerLeft{\includegraphics[width=\paperwidth,height=\paperheight]{pgfmanual}}
}
\begin{document}
\lipsum
\end{document}
Using wallpaper
:
\documentclass[a4paper]{article}
\usepackage{lipsum} %% gives dummy text for this file
\usepackage{wallpaper}
\CenterWallPaper{1}{pgfmanual}
\begin{document}
\lipsum
\end{document}
Further, tikzpagenodes
gives you additional hooks on the page using which one can insert the image with the help of tikz
and its remember picture
and overlay
options. This will be left as a practice assignment :)
remember picture
/overlay
solution may need several compilations.
Simplest way I know:
convert image to PDF (easiest way: use program mogrify
, part of imagemagick
) e.g.
mogrify -format pdf my_image.jpg
include the PDF in the document
\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf{my_image.pdf}
\end{document}
Disclaimer: answer based in http://www.bhalash.com/archives/13544791365
\includepdf{my_image.jpg}
.
Commented
Aug 1, 2017 at 16:46
The package incgraph
was made for such a purpose (among others).
My example includes two pictures. In the first case, the paper is resized to the dimensions of the picture. In the second case, the picture is scaled to fit to the given page. For both cases, any tikz
code can be overlayed; I used a text node.
\documentclass[a4paper,12pt]{article}
\usepackage{incgraph,tikz}
\begin{document}
\incgraph[
overlay={\node[red] at (page.center) {\Huge Paper sized to picture};}
]{example-image-a}
\incgraph[documentpaper,
overlay={\node[red] at (page.center) {\Huge Picture sized to paper};}]
[width=\paperwidth,height=\paperheight]{example-image-b}
\end{document}
width
or height
exclusively, the picture would go past the edges, if it becomes to large.
Commented
Jul 24 at 12:18
Any image file (e.g. supper.png) will do.
\documentclass{article}
\usepackage{graphics}
\usepackage{xcolor}
\usepackage[screen,nopanel]{pdfscreen}
\margins{0pt}{0pt}{0pt}{0pt}
\screensize{4.5in}{6in}
\backgroundcolor{lightgray}
\begin{document}
\vspace*{-0.16in} % only needed for first page
\noindent
\resizebox{\textwidth}{\textheight}
{\includegraphics{supper.png}}\hspace*{-\textwidth}
\raisebox{3in}[0in][0in]{\color{red}
\makebox[\textwidth][c]{\Huge Text over Image}}
\end{document}
The \vspace was determined by trial and error. I'm not sure why is is needed, but I suspect it has something to do with the title/author stuff.
A simpler solution uses \overlay{supper.png}, but then EVERY page would have the image.
This uses the stackengine
package's \hsmash
routine to overcome the l-r margin issue. The 9.35in is based on the textheight and asymmetric vertical margins of the article class on 11in paper (may need to be changed for other margins/classes). The insetting text is done with \stackinset
from the same package.
\documentclass{article}
\usepackage{stackengine}[2013-09-11]
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\pagestyle{empty}\centering%
\stackinset{c}{}{c}{}{\smash{\parbox{6in}{
%INSET TEXT HERE
\parskip 1em\lipsum[1-5]%
}}}{\vphantom{\rule{0pt}{\textheight}}%
\smash{\hsmash{\belowbaseline[-9.35in]{%
%IMAGE HERE
\includegraphics[width=8.5in,height=11in]{example-image}%
}}}}%
\end{document}
Read up on pstricks package. It can answer both of your questions.
\documentclass[12pt]{memoir}
\usepackage[paperheight=11in,paperwidth=8.5in,margin=0in]{geometry}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\pagestyle{empty}
\newsavebox\IBox
\sbox\IBox{\includegraphics[height=11in,width=8.5in]{cover/cover.png}}
\psset{unit=1in}
\pspicture(8.5in,11in)
\DeclareFixedFont{\PT}{T1}{ppl}{b}{n}{1in}
\rput[lb](-0.25,0){\usebox\IBox}
\rput[lb](2,2){\PT \color{white}{Your title here}}
\endpspicture
\end{document}
eso-pic
,background
,tikzpagenodes