How to anti-alias the threshold effect in images


I was looking into generating black-white images that were anti-aliased, but all I found were ways to definitely not do anti-aliased thresholding.

Among these non-solutions was an article that suggested using curves instead of threshold to just increase contrast a lot, and pretended that they had somehow created anti-aliased thresholding. What they actually made was a black and white photo with a lot of contrast, not even remotely similar to thresholding. And if you were to push it far enough to have the same contrast level as threshold would have, you would still end up with the same jagged edges and noise splotches as normal thresholding. People on forums were saying to blur it, which of course looks terrible, because you end up with all the same issues, but this time they glow.

Turns out the actual solution is pretty simple. You need to super-sample.

  1. Scale up the image 8x or 16x
  2. Apply the threshold effect.
  3. Scale the image back down to 1/8th or 1/16th the size.

As you can guess from how simple this is, it can be done in GIMP, Photoshop, Krita, really anything. If you are using Photoshop, I suggest using Preserve Details 2.0 when upscaling, so you’re maintaining as of the shape as possible. Maybe you could even use waifu2x.

You can do it using G’MIC, too, which would look something like this:

gmic input_image.jpg resize 1600%,1600%,1,3,3 adjust_colors 0,0,0,0,-100 threshold 127 normalize 0,255 resize 6.25%,6.25%,1,3,3 output output_image.jpg

Here’s a comparison of the different methods:

Standard threshold
8x supersampling using waifu2x
16x supersampling

Source image