# How do I add a background image to just a parbox?

I'm trying to design my CV and want to have a box at the top which contains some content on the left end (name and title) and content on the right (maybe a few rows containing contact info sorts of stuff). Currently I'm thinking of structuring that in parboxes and tabular environments.

\documentclass{article}
\usepackage[hmargin={.5cm,.5cm},vmargin={.2cm,0cm}]{geometry}

\begin{document}
% To contain the top bar:
\parbox{\paperwidth}{
% To contain the left side:
\parbox{12cm}{
% Name title stuff
}
% To contain the right side:
\parbox{4cm}{
\begin{tabular}{r}
% rows of info
\end{tabular}
}
}
% To contain the rest of the document:
\parbox{\paperwidth}{
% The rest goes here
}
\end{document}


I would like the top parbox to have a light transparent image behind it.

[Edit: More specifically I have an image that is, let's say, 1300px wide by 1000px tall (could change in the future). I would like the background image to fill the height of the top bar (parbox). So I want it to be the minimum of: The image height, 1000px, and the parbox height (which I suppose I could fix at 3cm or so). I want the width of the image to be whatever width maintains the aspect ratio of the original image. I also want the image centered in the top bar (parbox).]

Is there a way to accomplish this? Most of the similar solutions I've found put the image either in the upper-left or center of the image and not attached to an environment inside the page. Perhaps rather than attaching the image to the parbox I should just use eso-pic to just locate and scale the image manually?

I've only just started laying this out so if anyone has suggestions about restructuring how I control the layout, I'm open.

I've found this solution which I've tried adapting to my situation: Background image for minipage

However, I don't want the image to fill the surrounding box since the image is too small to scale nicely to that given size. I want the image to fill the height of the box and keep the aspect ratio (i.e. automatically scale the width so that the image renders as nicely as possible). I tried setting the height and width information manually but it just ended up rendering the picture outside of the minipage.

I also tried the answer on that page using mdframed but for whatever reason the image didn't render at all in that solution. The solution with tcolorbox renders but again the image is scaled too much. Would it be best if I just editted the image to make it wider and get around the scaling issue that way?

• it is quite unclear what scaling and size you actually want. – Ulrike Fischer Dec 20 '18 at 22:35
• @UlrikeFischer I've added an edit to hopefully make this clearer. – Addem Dec 20 '18 at 23:03
• One solution is to use tikz [remember picture,overlay] and another is to use everypage. – John Kormylo Dec 30 '18 at 16:47