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 !
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
If it's not installed on your computer python Environmental Science , You can take a look at the following 6 Minute fool installation tutorial , You can operate with a computer ~
Go straight to the code ! Code
# Import this library :python-office, Shorthand for office
import 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 .
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