views:

55

answers:

2

I'm trying to find some info about removing an image background "automagically" if possible in .NET.

Actually I could not find much data and I don't event know if it's possible or are there any API components available.

Any ideas?

A: 

Establish a rule, for example that the pixel at [0,0] must be the 'transparent' color (the background). Load the image as a Bitmap (let's call it bmp), and then do something like this:

bmp.MakeTransparent(bmp.GetPixel(0, 0));
allonym
It does work! But the borders of the images in the middle is not quite clear. (http://picasaweb.google.com/lh/photo/LvDyBlURCQ-IxQmQoFhdmA?feat=directlink). Do you know how can I find out colors that are similar to the one selected in the bmp.GetPixel(0,0) so I can also make those transparent?
Homer1980ar
Given your example image, you're going to find that it's not enough to make similar colors transparent. The background looks like it was black, and the figures in the image contain black line linework, so you'll risk dropping out important parts of the image (and you may lose the text at the top entirely!). If you can get away with it, it might be enough to impose a rule that the background color has to be distinct. If you can't do that, you really have your work cut out for you, as you'll be getting into some advanced image analysis.
allonym
A: 

Homer, for the file formats you suggest, there is no easy way of defining what the 'background' is. For instance, say you have some colorful text on a white background. I'm assuming you'd want to make the white transparent? There is nothing in the file format to say "this layer or color is the background". There may be heuristics for trying to determine the background color, but there will probably be no library to do something like image.MakeBGTransparent().

Josh Smeaton