Skip to content

Instantly share code, notes, and snippets.

View Coding-Lambda's full-sized avatar

Lucas Coding-Lambda

  • Switzerland
View GitHub Profile
@Coding-Lambda
Coding-Lambda / Program.cs
Created October 7, 2025 15:26
C# extract icon from exe in good quality
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
// Extract the icon as png to avoid quality loss, convert it back by using something like GIMP or so ...
var outputFile = new FileInfo("YourIconName.png");
using var icon = Icon.ExtractIcon(@"THE_FULL_PATH_TO_YOUR_EXE_FILE", 0, 48); // tweak the index parameter and desired extraction size if applicable
using var bitmap = icon.ToBitmap(); // convert to bitmap due to icon.Save(...) having quality issues!
using var fs = outputFile.OpenWrite();