How to create 2D Mesh from a simple 2D Texture


I have a simple 2D texture, say for example with black background, and then i have a circular shape in the center with red color. What’s the best way to write a code that recreates that shape as a procedural or dynamic mesh? Do I have to read it pixel by pixel?

Thank you in advance!