views:

347

answers:

2

I'd like to remove all of the black from a picture attached to a sprite so that it becomes transparent.

+1  A: 

This looks like it'll do the trick:

http://www.quartzcompositions.com/phpBB2/viewtopic.php?t=281

+1  A: 

I'll copy and paste in case that link dies:

" I used a 'Color Matrix' patch, setting 'Alpha Vector (W)' and 'Bias Vector(X,Y,Z)' to 1 and all other to 0. You will then find the alpha channel from the input image at the output."

I found this before, but I can't figure out exactly how to do it.

I found another solution using core image filter:

kernel vec4 darkToTransparent(sampler image)
{
  vec4 color = sample(image, samplerCoord(image));
  color.a = (color.r+color.g+color.b) > 0.005 ? 1.0:0.;
  return color;
}
thescreamingdrills