Showing posts with label image to icon. Show all posts
Showing posts with label image to icon. Show all posts

Thursday, June 16, 2011

Creating Icon from a image file in C#


using System; 
using System.Drawing; 
using System.IO; 
string sourceFile, destinationFile; sourceFile = "C:\imagen.jpg"; 
destinationFile = Path.ChangeExtension(sourceFile, ".ico"); 
using (Bitmap bitmap = Image.FromFile(sourceFile, true) as Bitmap) 
{ 
using (Icon icon = Icon.FromHandle(bitmap.GetHicon())) 
{
using (Stream imageFileStream = File.Create(destinationFile)) 
  { 
icon.Save(imageFileStream); 
Console.WriteLine("File Created - {0}", destinationFile); 

} 
}
}

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...