# Render a texture in background of text

I want to render some text in my latex document with some textured box in background. Like the one in the attached images. I tried the "tcolor" box package, but I don't think it allows you to render textured box in background of the text.

Any suggestions on how should I proceed with this task?

A slightly modified version of Martin Scharrer's answer from here should do the trick:

\documentclass{article}

\usepackage{graphicx}

\newlength{\imgwidth}
\newlength{\imgtocenter}

\newsavebox\mysavebox
\newenvironment{imgminipage}[2][]{%
\def\imgcmd{%
\settowidth{\imgwidth}{\includegraphics[width=\wd\mysavebox,height=\dimexpr\ht\mysavebox+\dp\mysavebox\relax,#1]{#2}}%
\setlength{\imgtocenter}{\dimexpr(0.5\wd\mysavebox-0.5\imgwidth)\relax}%
\hspace*{\imgtocenter}%
\includegraphics[width=\wd\mysavebox,height=\dimexpr\ht\mysavebox+\dp\mysavebox\relax,#1]{#2}}%
\begin{lrbox}{\mysavebox}%
\begin{minipage}%
}{%
\end{minipage}%
\end{lrbox}%
\sbox\mysavebox{\fbox{\usebox\mysavebox}}%
\mbox{\rlap{\raisebox{-\dp\mysavebox}{\imgcmd}}\usebox\mysavebox}%
}

\begin{document}

\noindent
\begin{imgminipage}[keepaspectratio]{example-image-a}{0.5\linewidth}
Some text\\
Hello world!
\end{imgminipage}

\noindent
\begin{imgminipage}{example-image-b}{\linewidth}
Some more text\\
Hello world!
\end{imgminipage}

\end{document}