As a data analyst, you should believe in a sentence ---- "a picture is worth a thousand words." However, what we have to say here is not data visualization, but a product form that is universally oriented to the public. ! ! !
Emoticon is not only a symbol, but also a kind of culture; it is one of the motives that promote social and even social development, just like laziness.
We insist that an excellent expression package should be a work of art. It is the inspiration that suddenly springs from the spring breeze. It is the emotional stirring of all kinds of mischief. It is the ambition to hang Yunfan into the sea. Pride is the triumph of glory that glides over the world. It cannot tolerate the linear deconstruction of code agriculture that uses its fixed form, fixed process, no beauty, no artistic change and surprise. However, in the process of producing expression packs, if you just mechanically import pictures into PS --> change text --> export, that's too low, so you'll still pass these very low mechanized repetitive actions to the program. do it.
Always thought that the automatic processing of the image, rely on JavaScript script to control the PS or AI; later found that Python can actually do some simple image processing, although may not be as strong as MATLAB. So for image processing, the complex part is still done manually in PS or AI, and simple processing can be done using Python programs.
Before starting work, let us pay tribute to the milestone figures in the expression package. Thank them for their remarkable progress in the historical trend. Their reputation will be talked about by the people for a long time and their voice will be appreciated. In people's daily social life, their outstanding contribution will always be engraved on the monument of the history of the package!
(If the expression can receive royalties, then do not have to go hard to play, shoot, broadcast...)
Material preparation
Here we use the expression of the most widely-kept Golden curator on the network as the center, with the panda's head as the background, and with the words underneath it can form an expression package.
Then use PS to deal with the picture size. The template size is set to 250*250.
Picture overlay
The first step is to superimpose the expression on the template. Notice that our facial expressions are white and not transparent. Therefore, the position must be controlled, otherwise the outline will be covered.
From PIL importImage, ImageDraw, ImageFont
Img = Image.open(".ackground.jpg")
Jgz = Image.open(".jgz.jpg")
Img.paste(jgz,(73,42))
Img.show()
This will see the composite picture:
There is a blank space at the bottom of this picture, which is to add text to our last step. Come on, the magic smile has been presented, followed by the final blow, are you OK?! Oh no, are you ready?!
Text overlay
Although the heart of the expression pack is the expression, a short, shocking text can often play a role in the finishing touch to the soul.
Draw = ImageDraw.Draw(img)
Ttfront = ImageFont.truetype('simhei.ttf', 24)
Draw.text((32, 190), "My heart doesn't fluctuate or even want to laugh", fill=(0,0,0), font=ttfront)
Img.show()
Img.save(".Python generated expression package .jpg")
This generates a complete expression package:
Where draw.text() is the input to the layer, so you can continue to execute this command to add multiple layers of text to the image.
You can also import multiple expressions, as well as multiple text lines, so that large-scale batch production of expression packages can be automated...
Problem sublimation
Do you think it is over here? Too young! Ask children's shoes to think about this issue:
The space for white space under expression packs is limited
Chinese and English and punctuation occupy different spaces
If the text is too long, it will require a line break; but if there are too many lines, the picture will not fit.
So when your brain suddenly flashes a line that contains both Chinese and English and N multi-punctuation to enhance the tone, how to design an algorithm to find the right font size, text insertion position, where the text wraps , so that the text can be displayed in the limited space, but also to meet a certain perception?
Forget it, or end it here...
So, through this serious and serious tutorial, we learned how to use Python for simple image processing, and get a practical technique: automatic production of expression packages.
The most important thing is that the old man often said, "I believe I can make you a lot of facial expressions in batches." It finally became a reality...
Toolkits For Cutting Mahine and Cutting Materials
It is suitable for the blade of the Screen Protector Cutting Machine and the tools for installing the Screen Protection Film.
If you want to learn more about Accesseries For Cutter,Screen Protector Cleaning Tool, Cutting Blade, Cell Phone Scraper Tool, Tool Kit, Cutting Head Parts please click "Product Details" to view Accesseries For Cutter,Screen Protector Cleaning Tool, Cutting Blade, Cell Phone Scraper Tool, Tool Kit, Cutting Head Parts parameters, models, pictures, prices and other information .
Whether you are a group or an individual, we will try our best to provide you with accurate and comprehensive information about Accesseries For Cutter,Screen Protector Cleaning Tool, Cutting Blade, Cell Phone Scraper Tool, Tool Kit, Cutting Head Parts!Accesseries For Cutter,Screen Protector Cleaning Tool, Cutting Blade, Cell Phone Scraper Tool, Tool Kit, Cutting Head Parts
Shenzhen Jianjiantong Technology Co., Ltd. , https://www.mct-sz.com