[Tex/LaTex] How to place a title in the tcolorbox to the bottom (left right) of the box

tcolorbox

The question is how to place a title in the tcolorbox to the bottom left/right of the box. I want to create something like the following picture. The main point here is the caption "My picture box" being in the bottom of the box.

enter image description here

Best Answer

Using the attach boxed title to bottom center key (along with minipage boxed title* to compensate the different width) you can easily achieve what you want:

enter image description here

The code:

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{mybox}[2][]{
  enhanced,
  arc=0pt,
  outer arc=0pt,
  minipage boxed title*=-1.95em,
  title=#2,
  fonttitle=\sffamily,
  watermark opacity=0.25,
  watermark stretch=1.00,
  watermark graphics=lichtspiel.jpg,
  attach boxed title to bottom center={yshift=2pt},
  boxed title style={
    enhanced,
    watermark opacity=0.75,
    watermark stretch=1.00,
    watermark graphics=lichtspiel.jpg,
    arc=0pt,
    outer arc=0pt,
  },
  #1
}

\begin{document}

\begin{mybox}{This is the title}
\lipsum[4]
\end{mybox}

\end{document}