views:

88

answers:

2

I have bitmaps of lines and text that have anti-alias applied to them. I want to develop a filter that removes tha anti-alias affect. I'm looking for ideas on how to go about doing that, so to start I need to understand how anti-alias algorithms work. Are there any good links, or even code out there?

+3  A: 

I need to understand how anti-alias algorithms work

Anti-aliasing works by rendering the image at a higher resolution before it is down-sampled to the output resolution. In the down-sampling process the higher resolution pixels are averaged to create lower resolution pixels. This will create smoother color changes in the rendered image.

Consider this very simple example where a block outline is rendered on a white background.

High resolution image

It is then down-sampled to half the resolution in the process creating pixels having shades of gray:

Low resolution image

Here is a more realistic demonstration of anti-aliasing used to render the letter S:

Not anti-aliased Anti-aliased

Martin Liversage
Alex Humphrey
+2  A: 

I am not familiar at all with C# programming, but I do have experience with graphics. The closest thing to an anti-anti-alias filter would be a sharpening filter (at least in practice, using Photoshop), usually applied multiple times, depending on the desired effect. The sharpening filter work best when there is great contrast already between the anti-aliased elements and the background, and even better if the background is one flat color, rather than a complex graphic.

If you have access to any advanced graphics editor, you could try a few tests, and if you're happy with the results you could start looking into sharpening filters.

Also, if you are working with grayscale bitmaps, an even better solution is to convert it to a B/W image - that will remove any anti-aliasing on it.

Hope this helps at least a bit :)

FreekOne
Thanks. I will look at sharpening filters. I have tried converting to greyscale and using a black/white filter, but often I have shapes that the filter assumes should be white, and I can't come up with a good threshold that works in all cases. A sharpening filter might be more intelligent, so I will investigate that option.
Jeremy
Glad to be of help. I wouldn't give up on the B/W conversion just yet though, because if you can live with having a B/W bitmap, this method would be your best bet. After converting to greyscale, try decreasing the luminosity while increasing the contrast. That will help quite a lot "cleaning" the image and defining the areas better before converting to B/W.
FreekOne
Interesting. I'll have to figure out how to calculate and manipulate luminosity. Good tips, thanks.
Jeremy
I recommend you look for brightness/contrast filters as they usually come together, or at least they are grouped together in most graphic editors. I'm sorry I can't help you further. The years of graphic design experience thought me how to use them and when, but not how they are actually created.
FreekOne