In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to watermark pictures in python. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
You can see that there is a watermark of the name of our official account in the lower right corner, isn't it super awesome? Let's take a look at the code, which is less than 20 lines.
The premise is to download a good library PIL. If you don't have it, download it first. I won't say much here.
Is not very simple, casually change can also be added in batches, you can also change the font to change the text position to achieve different results.
You only need to change the following two lines of code
# set font and font size
Font = ImageFont.truetype ('C:\ Windows\ Fonts\ HYS5GFM.TTF', 100)
# set watermark location
Text_xy = (layer.size [0] / / 2-text_size_x//2, layer.size [1]-text_size_y)
It should be noted here that when adding a watermark, the Chinese font cannot be displayed that the font you set does not have Chinese, so you need to change the corresponding font in Chinese.
We can also add pictures or logo to our pictures, such as this:
It is also good to put our logo on the picture, so it can not be pirated, and the code is less than 10 lines. One more thing: life is too short. I use python:)
About how to watermark pictures in python to share here, I hope the above content can be of some help to you, 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.