There exist many online png to ico convertors, however, this functionality is very easy in python. In this tutorial, we will introduce how to conver a png file to a ico file with python pillow library, you can learn and do step by step.
pip install Pillow
Load pillow library
from PIL import Image
Open a png image file
filename = r'logo.png' img = Image.open(filename)
Convert png to ico file with pillow
img.save('logo16.ico',format = 'ICO', sizes=[(32,32)])
To use Image.save() to convert png to ico, you must notice:
Image.save(fname, format=None, **params)
fname: it is the name of new image file
format: such as JPEG, ICO. You can know more formats in here.
sizes: if the image is ico, the (width, height) size may be [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (255, 255)]