It depends on how fast you need this to be. For example, you could use ROJOhound's Canvas plugin where you can paste the sprite to the canvas plugin, then loop through all pixels, get the color/alpha value with rgbaAt() and in case it's white replace the alpha with
Draw point (x,y) with "rgba(0, 0, 0, 0)"
Of course that wouldn't be very fast.