Python 3 Pillow Script to Convert PNG to Windows ICO File in Command Line Full Project For Beginners
Welcome folks today in this blog post we will be converting png to ico
file using pillow library in python. All the full source code of the application will be given below.
Get Started
In order to get started you need to install the following library using the pip
command
pip install pillow
After installing this library make an app.py
file and copy paste the following code
app.py
from PIL import Image
# Take input image from present folder
img = Image.open('input.png')
# Generate and save output image to present folder
img.save('output.ico')
Here we are including the library at the very first line of code and then we are opening the input
png file and then saving as ico
file
Now if you run this python script app.py
by typing the below command
python app.py
Your png image will be converted to ico
file