.ico files can contain multiple images with different resolutions. This allows the program that displays it to choose the most appropriate image depending on the context. For example, the Windows explorer can display icons of 16, 32, 48 or 256 pixels (more info). There are several ways to generate an ico file. However, many are based only on an image, or do not manage transparency properly.
After some research, I came across png2ico, a free software. The site does not pay any attention, but the tool responds correctly to the need. To use it, you must use a terminal:
png2ico.exe "favicon.ico" "logo_16x16.png" "logo_32x32.png" "logo_48x48.png" "logo_64x64.png"