private string convertExeIconToBase64(Process p) { try { if (p != null) { string filename = p.MainModule.FileName; Debug.WriteLine("Application: " + p.MainModule.FileName); IntPtr hIcon = IconExtractor.GetJumboIcon(IconExtractor.GetIconIndex(filename)); // Extract Icon string result; ImageConverter converter = new ImageConverter(); using (Bitmap ico = ((Icon)Icon.FromHandle(hIcon).Clone()).ToBitmap()) { Bitmap bitmap = IconExtractor.ClipToCircle(ico); result = Convert.ToBase64String((byte[])converter.ConvertTo(bitmap, typeof(byte[]))); bitmap.Dispose(); } IconExtractor.Shell32.DestroyIcon(hIcon); // Cleanup GC.Collect(); EmptyWorkingSet(Process.GetCurrentProcess().Handle); return(result); } } catch (Exception e) { Debug.WriteLine("Exception: " + e.Message); } return(null); }