What you could do is create a black silhouette out of the png
image through JavaScript (on top of a canvas), then place the output underneath the image.
JavaScript:
window.onload = function() {
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
var image = document.getElementById("imgSource");
context.drawImage(image, 0, 0);
var imgd = context.getImageData(0, 0, 300, 300); // width and height value
var pix = imgd.data;
var blackpixel = 21;
for (var i = 0, n = pix.length; i < n; i += 4) {
if (i > 3) {
if ((Math.abs(pix[i-3] - pix[i]) > 10) &&
(Math.abs(pix[i-2] - pix[i+1]) > 10) &&
(Math.abs(pix[i-1] - pix[i+2]) > 10)) {
pix[i] = blackpixel;
pix[i+1] = blackpixel;
pix[i+2] = blackpixel;
}
} else {
if (pix[i] < 250 && pix[i+1] < 250 && pix[i+2] < 250) {
pix[i] = blackpixel;
pix[i+1] = blackpixel;
pix[i+2] = blackpixel;
}
}
}
context.putImageData(imgd, 0, 0);
}
HTML:
<img id="imgSource" src="yourimg.png">
<canvas id="canvas" width="300" height="300"></canvas>
However, as others have said, you should probably just do this with an SVG. Or create the border yourself within Photoshop, as this solution is very limited with what it can do.
Credit to this post, for the answer.