Next thought:
The original-> grayscale-> is mapped to the specified sequence of characters based on pixel brightness--> output.
The more characters, the more dense the characters change. Effect will be better.
If you make a character picture based on the pixel brightness range of a grayscale image, the effect is better.
If you use the palette again, the character is changed to color, more like the original.
This is the original image:
This is the generated character drawing:
Nonsense not much to say, directly on the code:
Copy Code code as follows:
Import Image
Chars = "... ',;: clodxklo0dgeknwmm"
Fn=r ' C:\users\liabc\desktop\jianbing.png '
F1=lambda F: '. Join ([(k%100!=0) and M or m+ ' \ n ' for k,m in enumerate (apply (lambda X:[chars[x[j,i]%len (chars)] for I in Xra Nge to J in Xrange (MB)], (Image.open (F). Resize ((100,70)). Convert ("L"). Load (),), 1)]
F=open (R "C:\users\liabc\desktop\aface.txt", "W")
F.write (F1 (FN))
F.close ()