Make a glow on the canvas using a series of overlapping shadows with increased blur.
A Demo: http://jsfiddle.net/m1erickson/Z3Lx2/

You can change the glow style by changing the number of overlays and the blur size.
Sample code for the glow effect:
var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d");
To get the outline of the image of your phone, you can use the marching ants algorithm.
This algorithm will create a path describing the image.
In your case, you define the image as all opaque pixels.
Here's a very good implementation of marching ants, which is used in the excellent d3 library:
https://github.com/d3/d3-plugins/blob/master/geom/contour/contour.js
It is used as follows:
Draw your phone on canvas.
Get an array of pixel colors from the canvas using ctx.getImageData p>
Define a function that checks the pixel array for opaque pixels on any x, y on the canvas.
Call loop function:
// call the marching ants algorithm // to get the outline path of the image // (outline=outside path of transparent pixels var points=geom.contour(defineNonTransparent);
Here is an example:

markE
source share