I have an image with a black background with white elements in the foreground. The image has smoothing, so there are 'in-between' pixels that aren't strictly black or white. I'd like to make the background transparent. I found several links on how to do this with imagemagick, but all of them strictly replace one color (say #000000FF" with full alpha "#00000000"). I want to preserve blending... so if there's a gray pixel "#777777FF", it'd get transformed into something like "#FFFFFF77", or whatever would make sense.
Does anyone know how to do this?