In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to use python to generate character paintings. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Python character painting is a simple and interesting Mini Program, very suitable for beginners to zhuang (bi). The principle of python character painting is very simple, which can be summed up in a sentence: replace the picture pixels with different characters, so as to transform the picture composed of pixels into a character painting composed of characters. In order to make the character painting show the same effect as the picture as much as possible. Pixels with high gray values are represented by visually deep characters (such as $), and pixels with lower grayscale values are represented by visually shallow characters.
Running under python3, you can generate character paintings by entering pictures. The general principle is mentioned in the notes. I did not have an in-depth understanding of the specific relationship between pixels and symbol conversion.
Run the command:
Python3 draw.py-width 60-height 30 test.png
The following is the effect picture:
Note:
The display effect may be different in different environments, such as whether the font displayed by the terminal is the same width font, the line height and width of the terminal display, the width and height of the input and output image, etc., all these will affect the display effect.
In addition, the character set used in the character painting has a total of 70 characters, which is the following line of code:
The more the type and number of characters, the more colors will be displayed, and the hierarchical sense of character painting will be better. You can adjust repeatedly according to the effect of character painting.
On how to use python to generate character painting to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.