Here is an attempt with TikZ, using the calc and fadings libraries. The code is heavily inspired by some drop-shadow work done by Caramdir at Faded drop-shadow using tikz-based rounded rectangle?
I defined a command \framenode, which accepts one optional and one mandatory argument:
\framenode[<frame-radius>]{<node>}
where <frame-radius> is the radius of the fade around the rectangle, as a dimension (default 10pt), and <node> is the name of the node to frame.
The command only works on rectangular nodes. For the example, I've placed an image in a node called image with inner sep=0 so the node tightly fits the image dimensions. Then I use
\framenode[15pt]{image}
to frame the node image with a fade of radius 15pt.
Update: It turns out I made my life much harder than it needed to be. Much simplified code is posted now. The radial shading and clipping were both unnecessary because of the way pgf handles "pixel painting" when transparency is involved. There is a slight difference in the corners, but I don't think it's overly significant. It also avoids the viewer aliasing problems inherent in the first version.
Complete Code:
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc,fadings}
\tikzfading[name=fade l,left color=transparent!100,right color=transparent!0]
\tikzfading[name=fade r,right color=transparent!100,left color=transparent!0]
\tikzfading[name=fade d,bottom color=transparent!100,top color=transparent!0]
\tikzfading[name=fade u,top color=transparent!100,bottom color=transparent!0]
% this "frames" a rectangle node
\newcommand\framenode[2][10pt]{
\fill[white,path fading=fade u] (#2.south west) rectangle ($(#2.south east)+(0, #1)$);
\fill[white,path fading=fade d] (#2.north west) rectangle ($(#2.north east)+(0,-#1)$);
\fill[white,path fading=fade l] (#2.south east) rectangle ($(#2.north east)+(-#1,0)$);
\fill[white,path fading=fade r] (#2.south west) rectangle ($(#2.north west)+( #1,0)$);
}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=3in]{example-image-a}};
\framenode[15pt]{image} % opt. arg. is fade radius; mand. arg. is node name to frame
\end{tikzpicture}
\end{document}
Before (complex code)

After (simplified code)

\framenodeinstead:\framenode[5pt]{nodetoframe}and change5ptto any dimension you want to use for the margin. – Paul Gessler May 09 '22 at 15:33