\documentclass{article}
\usepackage{graphicx}
\usepackage[pdftex,tight,designiv]{web}
\usepackage{graphicxbox}

\title{GraphicxBox Test File\texorpdfstring{\\}{: }Using the \textsf{Graphicx} Package}
\author{D. P. Story}
\subject{Graphic backgrounds to latex boxes}
\keywords{LaTeX, PDF, AcroTeX, graphics, backgrounds,}
\university{Acro\negthinspace\TeX.Net}
\email{dpstory@acrotex.net}
\def\webversion{\textcolor{webbrown}{www.acrotex.net}}
\revisionLabel{Prepared:}
\versionLabel{}

\newcommand{\cs}[1]{\texttt{\char`\\#1}}

\parindent0pt\parskip\medskipamount
\pagestyle{empty}

\begin{document}

\maketitle

This demo file---produced by \textsf{pdftex}---for the \textsf{graphicxbox} package for users
that are using the \textsf{graphicx} package, and not the
\textsf{graphicxsp} package, the latter requiring the distiller.\footnote{The package should work for any driver that supports the \textsf{color} package.}
This package delivers two commands, these are \cs{graphicxbox} and
\cs{fgraphicxbox}. These two are modeled after \cs{colorbox} and
\cs{fcolorbox} of the \textsf{color} package. These new commands are
similar to their colorful counterparts, but they insert a graphical background
in the box rather than a color background.

The syntax for \cs{graphicxbox} is
\begin{verbatim}
    \graphicxbox[<includegraphics options>]{<graphic>}
        {<box content>}
\end{verbatim}
The optional parameter is passed to the \cs{include\-graphics}
command, which is used. Do not use the \texttt{scale},
\texttt{width} or \texttt{height} options of \cs{include\-graphics},
the graphic is scaled to fit the box by \cs{graphicxbox}. The required
parameter \verb!{<graphic>}! is also passed to \cs{include\-graphics}.

Let's see an example.

\begin{center}
\graphicxbox{graphics/indianblanket}{%
  \begin{minipage}{.67\linewidth-2\fboxsep} %
  \footnotesize\bfseries\color{red}This is `the Indian Blanket' background
  graphic. These graphical background can be used for more interesting displays
  of content, or for an eye-catching presentation. Every time you create a
  box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again.
  \end{minipage}}
\end{center}

\cs{fgraphicxbox} does the same as \cs{graphicxbox}, but places a colorful frame around
the box, just as \cs{fcolorbox} does. The syntax is
\begin{verbatim}
    \fgraphicxbox[<model>]{<specification>}
        [<includegraphics options>]{<graphic>}{<box content>}
\end{verbatim}
The first two (color) parameters are passed to the \cs{color} command, which takes
two parameters. The other three parameters are the same ones for \cs{graphicxbox}.

Here's an example

\begin{center}
\fgraphicxbox{red}{graphics/indianblanket}{%
  \begin{minipage}{.67\linewidth-2\fboxsep} %
  \footnotesize\bfseries\color{red}This is `the Indian Blanket' background
  graphic. These graphical background can be used for more interesting displays
  of content, or for an eye-catching presentation. Every time you create a
  box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again.
  \end{minipage}}
\end{center}

As with \cs{colorbox} and \cs{fcolorbox}, the space around the box is equal to
\cs{fboxsep} on all sides, and the width of the rule is \cs{fboxrule}. These can
be changed as desired.

Here's a few more examples of graphical backgrounds.

\begin{center}
\graphicxbox{graphics/Wood-Brown}{%
  \begin{minipage}[b]{0.5\linewidth-2\fboxsep}
  \footnotesize\bfseries\color{webgreen}This is a wood-brown background, perhaps `webgreen'
  is not the best text color for this background, but, then again, I have no feel
  for color at all. In fact, I really wonder if I know what I'm doing at all. I'm pretty
  confused and disoriented most all the time.
  \end{minipage}}
\end{center}


\begin{center}
\graphicxbox{graphics/news_bgr}{%
  \begin{minipage}[b]{0.5\linewidth-2\fboxsep}
  \footnotesize\bfseries Here's a gradient-type background that I downloaded from
  the Internet. Once can, in theory, download any of your favorite backgrounds
  and use them as background graphics for a box.
  \end{minipage}}
\end{center}

What if you have a graphic that has an aspect ratio that cannot be changed
because it would distort the graphic? To use such a graphic requires the knowledge
of the dimensions of the graphic.

Let's try a photo for a graphic, now we must take care to preserve
the aspect ratio. We simply create the box so that its
dimensions have the same aspect ratio as that of the photo. Like so
{\small\begin{verbatim}
  \begin{minipage}[b][112.45bp-2\fboxsep]{149.665bp-2\fboxsep}
      \footnotesize\bfseries\color{white}%
      This is the mighty Grand Canyon, as seen from the south rim.
      Beautiful!
  \end{minipage}
\end{verbatim}
}Here, \texttt{149.665bp} and \texttt{112.45bp} are the dimensions of the photo.
Wrap this box in \cs{graphicxbox} using the \texttt{grandcanyon} photo and we have\dots
\begin{center}
\graphicxbox{graphics/grandcanyon}{%
  \begin{minipage}[b][112.45bp-2\fboxsep]{149.665bp-2\fboxsep}
  \footnotesize\bfseries\color{white}This is the mighty Grand Canyon, as seen from the
  south rim.  Beautiful!
  \end{minipage}}
\end{center}

Interesting. Now, let's try framing this picture.

\begin{center}
\setlength{\fboxrule}{4bp}
\fgraphicxbox{webblue}{graphics/grandcanyon}{%
  \begin{minipage}[b][112.45bp-2\fboxsep-2\fboxrule]{149.665bp-2\fboxsep-2\fboxrule}
  \footnotesize\bfseries\color{white}This is again, the mighty Grand Canyon, as seen from the
  south rim.  Beautiful!
  \end{minipage}}
\end{center}
We've also modified the lengths of \cs{fboxsep} and \cs{fboxrule}.

Cool! That's the \textsf{graphicxbox} package.
\end{document}
