Archive for December, 2008

Remove White Background

Hi, long time that I don’t post here…

I’ve been helping Romu here at work where he was trying to use a JPG instead of a PNG with alpha channel.
Why he was trying to do that?
Firstly he was using PNGs but each image was around 600 kb. So he was trying somehow remove the white background from those images because saving as JPG it’s less than 60kb.

It’s not a perfect background remover, but it works with the website he’s developing.

I don’t know if there are easier or more accurate chroma-key like background removing techniques, but… here is my workaround.

The images is not from the website… it’s a Brazilian cartoon called ‘A Turma da Mônica’

Sources?
Not yet… I’m busy right now but I’ll try to explain how I did it.

1. Using ColorMatrixFilter, I converted each RGB channel to the alpha channel.
2. Using BitmapData.threshold, converted every pixel with alpha bigger than 0 to black.
3. Applyed a Blur.
4. Mask the original Bitmap using cacheAsBitmap = true;

Vote in HexoSearch Vote

Comments (4)