Many different programs support the ICO icon format, the file format used by many applications, especially Windows, to encode small images used in user interfaces. You can convert files in other image formats, like PNG or BMP, into ICO simply by opening them in one of these programs and using the Save As command to create a new ICO copy of the image. Many such programs exist, some of which are installed by default with certain operating systems.
Obtain a graphics program that is capable of saving in the ICO format. These aren't rare -- even simple graphics editors usually support this format. In Windows, the popular Irfanview (irfanview.com) editor can save in ICO; in Linux, the standard Eye of GNOME or Gwenview programs, installed by default with the GNOME and KDE desktop environments, respectively, both support ICO, as does the multiplatform image editor GIMP (gimp.org).
Open the PNG or BMP you want to convert in your image viewer, using the viewer's "Open" command.
Use the viewer's "Save As" command -- usually in the "File" menu -- and select "ICO" from the "File type" drop-down menu. Enter a name for the new file, then click "Save." The editor will create a new copy of the image, using the ICO file extension and format.