06 Dec 2015
A webapp that takes an image and for each pixel sets
A = (255 - (R + G + B)/3)
That is, each pixel’s opacity is the inverse of its brightness (I used the simple “average value” interpretation of brightness).
So if you have something on a white background (strongly suggest clipping that background to #FFF with levels in Photoshop or something first), you can extract that onto a transparent background without the jagged edges that a simple threshold-based magic wand would create.
JQuery uploads the selected image via AJAX to my Flask backend, which does the above operation using PIL, and returns it as a base64 encoded string.