程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

A treasure cartoon avatar 50 yuan? 1 line of Python code, dont pay IQ tax again

編輯:Python

Hello everyone , I am a Python Programmer Wanfeng .

today , Introduce to you python-office The function just updated today :1 Line code , Generate animation avatar .

It is said that a treasure needs 50 $1 ? Stop paying the IQ tax !

1. install python-office

Easy to install , There is python On the computer of the environment , Just execute the following command line .

If you have used python-office This library , You also need to perform , You can download to the latest version ~

install

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-office -U

2. Generate animation avatar

Go straight to the code !

Code

# Import this library :python-office, Shorthand for officeimport office# 1 Line code , Realization Portrait to cartoon avatar office.image.img2Cartoon(path = 'd://image// Programmer Wanfeng .jpg')# Parameter description :# path: Where to store your own live photos + PDF The name of the file , for example :d://image// Programmer Wanfeng .pdf

Run the above code directly , You will get a converted cartoon avatar .

The program may need to run 20 About seconds .

3. All functions

1 Lines of code implement complex functions , Is it convenient to use ?

The project has been included in 【 Open source in China 】、【Python Official website 】 Such as platform , All functions , Free for everyone to use :GitHub


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved