uniramp
uniramp
Timeline:
TL;DR: I made uniramp to try text art with more kinds of characters, especially CJK. It measures the visual density of the glyphs in a chosen font and uses the result to turn images into text.
Starting with character ramps
I have always liked seeing people use characters to create light and dark areas in text art. Most examples use a familiar ASCII ramp, which made me wonder what the same idea would look like with a much larger set of characters, especially CJK.
That became uniramp. I give it a font and a character set, and it builds a ramp from the glyphs in that font.
The "Ramp"
I first needed a way to tell whether one glyph looked darker than another. I use FreeType to render each glyph and measure how much of its cell is filled. Sorting those measurements produces the ramp.
I kept the measurement code in C++ and exposed it to Python through pybind11. I also added a graph view because seeing the characters side by side made the result much easier to understand.
With this, one can check the ordering to make sure if the output can preserve the structure of the source image. It also gave me a quick way to see what changed when I used another font or character set.