46

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?

  • there are a few packages that can help with this: eso-pic, background, tikzpagenodes – cmhughes Oct 8 '13 at 3:45
  • For use of 'background' and 'eso-pic' approach, you might want to see here tex.stackexchange.com/a/134795/34618 – Jesse Oct 8 '13 at 4:24
  • 3
    BTW, a physical printer can't actually print all the way to the edge of the paper. They have to print on larger paper and cut off the margins. This is only useful for computer display. – John Kormylo Oct 9 '13 at 18:15
  • It is useful for printing to PDF or sending your work to a publisher who can print arbitrary page size. – ajeh Oct 9 '13 at 20:45
  • @JohnKormylo it may not be relevant here but some (photo) inkjets can do "borderless" and IIRC we had a xerox colour laser at my old work that could do full bleed (which something like tripled the price over one that couldn't). If however the OP is including it in something to be printed on a system he doesn't control, your warning is well-placed. – Chris H Mar 4 '14 at 17:34
30

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.

enter image description here

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 :)

  • I suggest mentioning the remember picture/overlay solution may need several compilations. – user10274 Mar 4 '14 at 16:55
15

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}

enter image description here

9

Simplest way I know:

  1. convert image to PDF (easiest way: use program mogrify, part of imagemagick) e.g.

    mogrify -format pdf my_image.jpg

  2. 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

  • 4
    You don’t even have to convert it first, you can just go \includepdf{my_image.jpg}. – doncherry Aug 1 '17 at 16:46
  • 1
    @doncherry this should be an answer, not a comment. It works perfectly. Best answer imho. Does not qualify for bonus points though ;) – leonardkraemer Mar 9 '19 at 10:19
7

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. last supper

A simpler solution uses \overlay{supper.png}, but then EVERY page would have the image.

5

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}

enter image description here

1

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}
  • 3
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Werner Oct 9 '13 at 20:45
  • Huh? This is an answer to the original question. What critique are you referring to? – ajeh Oct 9 '13 at 20:52
  • 4
    In my opinion, telling someone to read the manual doesn't really help answer the question. Moreover, where in the PStricks documentation is there a reference or even an example on how to place an image that spans the entire page (width and height)? – Werner Oct 9 '13 at 21:06
  • I never actually said 'manual'. – ajeh Oct 11 '13 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.