Get outlines/border of Material mask

I have a procedurally generated mask like this:

190955-shape.png

and would like to create a new mask from it by getting only the outlines of the shape:

190956-shape2.png

reason: I want to create a colored border with it later on.

I fond the ComputeFilterWidth node, but that generates a very pixelated and dirty result

Bump. I need it as well:

  1. how to mask/select material ID in the material editor
  2. and then select it’s border/outline?