I want to make a shaded image border. My current solution is using \shadowbox:

 \documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{fancybox, graphicx}

\begin{document}
\color{blue}
\end{document}


So 1) there must be a white border 2) which casts a shadow. But this creates a very "simple", solid shadow:

I would like to achieve a more "blurry effect".

Based on this answer I wrote something like this:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[skins]{tcolorbox}
\usepackage{fancybox, graphicx}

\begin{document}
\begin{center}
\begin{tcolorbox}[enhanced,width=12cm,height=8cm, center upper,
boxrule=0.4pt,sharp corners,colframe=yellow!80!white,colback=white!10]

\includegraphics[width=12cm,height=7.9cm,keepaspectratio]{example-image-a}
\end{tcolorbox}
\end{center}
\end{document}


but as you can see, I need this colorbox to scale with my image (which is max 8x12cm, keeping aspect ratio).

I saw some overly complicated answers with applying some rules but I really believe there must be a simpler solution.

Besides - can the above solution actually drop shadows to 4 sides of the world, not only southeast etc?

\tcolorbox is either using the \linewidth or the sizes specified with width and height which may be wrong considering the internal content.

\tcbox changes the size according to the inner content and scales appropriately.

I have defined a \whiteshadowbox with some options, the centering is done with the before and after keys.

\documentclass[12pt]{article}
\usepackage[skins]{tcolorbox}

enhanced,
center upper,
fontupper=\large\bfseries,
boxrule=0.4pt,
sharp corners,
colframe=blue,
colback=white!10,
before={\begin{center}},
after={\end{center}},
#1%
}

\begin{document}
\includegraphics[width=12cm,height=7.9cm,keepaspectratio]{example-image-a}
}

\includegraphics[width=5cm,height=6cm,keepaspectratio]{example-image-a}
}
\end{document}


Update with halo option

\documentclass[12pt]{article}
\usepackage[skins]{tcolorbox}

enhanced,
center upper,
fontupper=\large\bfseries,
fuzzy halo={0.9mm with gray},
boxrule=0.4pt,
sharp corners,
colframe=blue,
colback=white!10,
before={\begin{center}},
after={\end{center}},
#1%
}

\begin{document}
\includegraphics[width=12cm,height=7.9cm,keepaspectratio]{example-image-a}
}

\includegraphics[width=5cm,height=6cm,keepaspectratio]{example-image-a}
}
\end{document}


With size=tight and boxsep=1cm settings

\documentclass[12pt]{article}
\usepackage[skins]{tcolorbox}

\tcbset{
halobox/.style={
enhanced,
center upper,
fontupper=\large\bfseries,
size=tight,
boxsep=1cm,
fuzzy halo={0.9mm with gray},
boxrule=0.4pt,
sharp corners,
colframe=blue,
colback=white!10,
before={\begin{center}},
after={\end{center}}}
}

halobox,
#1%
}

\begin{document}
\includegraphics[width=12cm,height=7.9cm,keepaspectratio]{example-image-a}
}

\includegraphics[width=5cm,height=6cm,keepaspectratio]{example-image-a}
}
\end{document}


• Instead of fuzzy shadow use fuzzy halo to get a 'full shadow'
– user31729
Dec 27 '17 at 16:50
• Thank you. Is there a way to manipulate the size of the box? Let's say that in your latter example I would like the green area to be 1cm wide in each directon?
– kch
Dec 28 '17 at 10:06
• @kch: \whiteshadowbox[colback=green,boxsep=1cm]{...} should work
– user31729
Dec 28 '17 at 13:17
• @kch: Added a third example (without screen shot, however. See the halobox style settings.
– user31729
Dec 28 '17 at 21:35

It's is very simple with the pstricks module pst-blur:

\documentclass[12pt, svgnames]{article}
\usepackage{graphicx}
\usepackage{pst-blur}
%\usepackage{auto-pst-pdf}% to compile with pdflatex --enable-write18 (MiKTeX) or pdflatex --shell-escape (TeXLive, MacTeX)

\begin{document}

\begin{pspicture}