Hashbrown
Hashbrown

Reputation: 13023

Image-to-Hanzi library

I'm trying to create an 'ascii' (unicode, but you know) image renderer with higher fidelity for terminals.

You can see most current implementations treat each textual character as a pixel, which requires a high density to achieve clarity.

Others use simple brightness scale to add a colour lightness gradient to the block, or braille to render sub-character pixels.

Currently I have gone with hexgrams, doing a basic downscale to translate pixel data into a series of bi-coloured characters to assist with blending using a reduced colour palette (mostly because braille, annoyingly, with at most only three subpixels in the first column likes to collapse on non-monospace fonts, whereas hexgrams always stay "square").

enter image description here

Now this still uses way too many columns and rows for my liking, but another section of unicode that has a lot of pixel-variety and maintains squaredness is the CJK hanzi/kanji.. and then I came across this.

enter image description here

Now this is really special, someone, somewhere, has done the painstaking effort I was just about to.

Take note of the top of the cat's right eye at the end.

It's not doing simple lightness with greater granularity, it's maintaining edges over the animation frames in its character-pixels.

enter image description here

So, I can now close a million tabs learning on image-fingerpinting (and not run a convoluted script pre-indexing the thousands of Chinese characters), right?

Well... I cannot find by whom nor how this was generated. I found one 'ascii' generator using Hanzi, but it is a basic lightness scale :(

Do any fellow engineers here have any ideas on A, how to best go about this if I am to re-invent this wheel, or preferably B, have better googlefu than I and locate this amazing piece of work?

Upvotes: 0

Views: 32

Answers (0)

Related Questions