Charalize images
Using block routine (class Blockways
) or pixel routine (class Pixelways
) to convert your images to texts 😆
Here is a tagert image where a lovely 🐱 (cat) inside, and we want to convert it.
It is an intuitive algorithm, and pertty effective either.
It, however,
has a great flaw which will be seen in a relatively bigger font size.
Here is an example (Using NotoSansCJK-Regular.ttc
, font size is 12, spacing is 3)
In luma based algorithm, a character is been thumbnailed into 1 by 1 piexl, and get its luma comparing with thumbnailed origin image to get a suitable character.
This would not be accurate when a character is too big, as single luma value cannot correctly indicate the most suitable replacement.
So we need to compare each block pixel by pixel. We can vectorize that block, and calculate the vector distance.
Here we go (Using NotoSansCJK-Regular.ttc
, font size is 12, spacing is 3)
Comparing with euclidean distance, cosine distance seems to be sensitive at edges in that image.
Let's take a look on it (Using NotoSansCJK-Regular.ttc
, font size is 12, spacing is 3)
Well, I find one vector distance algorithm used to calculating the distance between texts that applying it here is interesting.
At the end, let's take a comparsion of these algorithm above.
Well, all algorithms above seem losing the charming smile of that cat.
☹🔫