Im trying to add a border on a PNG image I have (Example included). The thing is that when I add the border currently it adds it on a box shape around all the image and not
Came across needing to do this myself - came up with this hack. A series of overlaid images behind my original that were slightly out of step with each other. Context ctx3 is a copy of the original image and this would replicate a white silhouette behind the original several times.
ctx3.shadowColor = "rgba(255,255,255,1)";
ctx3.globalCompositeOperation = 'source-over';
ctx3.shadowOffsetX = 2;
ctx3.shadowOffsetY = 2;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = -2;
ctx3.shadowOffsetY = -2;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = -2;
ctx3.shadowOffsetY = 2;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = 2;
ctx3.shadowOffsetY = -2;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = 0;
ctx3.shadowOffsetY = 2;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = 0;
ctx3.shadowOffsetY = -2;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = 2;
ctx3.shadowOffsetY = 0;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);
ctx3.shadowOffsetX = -2;
ctx3.shadowOffsetY = 0;
ctx3.shadowBlur = 0;
ctx3.drawImage(YourImageSource,0,0);