Extract an Icon from any file

Description :

This function will extract an Icon from any file and save it in the target location.

private void Image2Icon(string fileName, string targetFileName)
//Creats filename with ico extention
string newFileName = Path.ChangeExtension(targetFileName, ".ico");
//Getting the Icon from the Filename
using (Icon icon = Icon.ExtractAssociatedIcon(fileName))
//Creating the Icon file and Writing the content
using (Stream stream = File.Create(newFileName))


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: