Screen Space anti aliasing? I have the following challenge. I am given a black and white image with rasterized lines.

Given this input, I want to extend the edges to cover more than one pixel and antialias the edges.
My first attempt was to pass a morphological dilation followed by a gaussian filter. But that straight up did not work, all i got is for the image to look blurry.
I instead tried combining both effects into a single shader and go the following:


This is decent, but you can still see a lot of the original aliasing of the edges.
Assuming that I only have the input image, are there any image based / screen space based AA techniques I can use to make the edges look smooth?
The easiest way to deal with this would be to provide thickness for the edges in the continuous setting. That is, make your edges out of solid capsules/cylinders, then you would not have this issue. Technically, this is is neither a supersampling nor a filtering technique, but rather a reformulation of the problem in the continuous setting. Another equivalent reformulation is considering only the vertices and then your reconstruction function being thick edges between those (using a thick line algorithm).
This doesn't seem to be your setting however? Since you mentioned that you only have the raster (aliased) image already, in which case you have already introduced the error so it is hard to get rid off. If you can &quot;access&quot; the continuous model it is a lot easier to fix. If you cannot, then I could recommend using a different reconstruction filter than the dilation that you are using. For instance you can do a thickening based on distance to pixels (sdf) with a step function. This should remove the issues you are having, at least for the example you showed.