TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to put a background image on a title page of a document. Is it possible and does it work?

EDIT: The answer by Presidenten using the eso-pic package and my answer found after some research using the wallpaper package both work.

share|improve this question

migrated from stackoverflow.com Feb 29 '12 at 19:11

This question came from our site for professional and enthusiast programmers.

up vote 51 down vote accepted

Assuming you have a background file named background.png - Add this code before \begin{document}

\usepackage{eso-pic}
\newcommand\BackgroundPic{%
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
\includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{background.png}%
\vfill
}}}

...and this immediately after \begin{document}:

\AddToShipoutPicture*{\BackgroundPic}

The * will make sure that the background picture will only be put on one page.

If you wish to use the picture on multiple pages, skip the *:

\AddToShipoutPicture{\BackgroundPic}

Then use this command to stop using the background picture:

\ClearShipoutPicture
share|improve this answer
    
Your solution with eso-pic is working. I found myself a solution in the meantime (look my answer), that is working too. So some choice for other reader. And upvote for your answer. :-) – Mnementh Oct 27 '08 at 18:47
    
Of course if you get ! Undefined control sequence... \includegraphics, you're missing a graphics package such as \usepackage{graphics} – DrMeers May 30 '12 at 12:48
    
Is it possible to pass the filename for the picture as a parameter, as in \AddToShipoutPicture{\BackgroundPic{fig1.png}} instead? What modifications have to be done to the code? – Kagaratsch Nov 4 '15 at 20:45

After some research, I found an answer myself. This is a little bit different to the answer by Presidenten, both solutions work.

The package wallpaper works well for this purpose.

You need to import the package in the header:

\usepackage{wallpaper}

After that you can use commands like:

\ThisLRCornerWallPaper{0.5}{somerights.png}
\LRCornerWallPaper{0.5}{somerights.png}

The LRCorner-command places the image in the lower-right corner of the site. There are commands like \ULCornerWallPaper and so on for the other corners and \CenterWallPaper and \TileWallPaper for centering or tiling the image.

The This at the start of the command places the image only on the current page, without this the image is placed on all following pages.

The numerical argument {0.5} scales the image to 0.5 the size of the page.

share|improve this answer
1  
what's the option to place the image at the "utter-center" ? Thanks by advance ! – user15363 Jun 6 '12 at 19:50
1  
\CenterWallPaper{scale}{filename} – cfr Dec 14 '13 at 15:38
1  
Didn't work for me. Nor does it show any error but just no image. – Abi May 1 '14 at 12:08
    
@Abi more details would be useful if you want help. – TheGrimmScientist Jan 11 '15 at 19:44
    
@Abi Indeed. Without any text or paragraph, it says No pages of output. Just add some text before or after \ThisLRCornerWallPaper{0.5}{somerights.png}, and it will work just fine. – guest_5758 Dec 6 '15 at 13:18

The @david-carlisle response is perfect. But for my particular case I had to add the transparent parameter, as indicated below.

\usepackage{transparent}
\usepackage{eso-pic}
\newcommand\BackgroundPic{%
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
{\transparent{0.4} \includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{background.png}}%
\vfill
}}}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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