Skip to content

Instantly share code, notes, and snippets.

@Stevoisiak
Created March 6, 2017 19:38
Show Gist options
  • Save Stevoisiak/1ede59568ba58f7bda78613fcfc15542 to your computer and use it in GitHub Desktop.
Save Stevoisiak/1ede59568ba58f7bda78613fcfc15542 to your computer and use it in GitHub Desktop.
Extract .ico icon file from .exe with 7zip
You can extract .ico icons from an exe with 7-zip!
@tomcass240
Copy link

how?

@Stevoisiak
Copy link
Author

@tomcass240 To be honest, I don't remember posting this gist or what the context was. However, I believe you can open an exe as an archive with 7zip to find the icon file.

@WinkelCode
Copy link

WinkelCode commented Jun 27, 2022

Thank you for posting this, I needed to get some icons for my new Streamdeck and after a lot of searching (and not wanting to install another application that needs admin rights) I finally found this.

For example here is the VS Code icon: C:\Users\{MY USERNAME}\AppData\Local\Programs\Microsoft VS Code\Code.exe\.rsrc\1033\ICON\2.ico There is also a file called 1 which seems to be a PNG according to the header.

Edit: Seems like the best way to get the best icon is to find the largest file. Numbering is unreliable, Windows Terminal for instance has 0 as its lowest resolution. Files without extensions seem to be PNGs. I think the PNGs should generally be the best resolution, in VS Code's case it's smaller than the largest icon, but I suspect that's because of better compression.

@kanjieater
Copy link

this was almost useful!

@wiktorwiktor11
Copy link

wiktorwiktor11 commented Mar 28, 2024

its useful, yall really need a tutorial to download 7zip and right click on an exe ,open archive and go to icons?
(use this as a tutorial 💀)

btw the files with out extensions in the end are png files

@geextahslex
Copy link

awesome info, thank you :)

@ShahriarKh
Copy link

Cool trick! thanks

@cbrunnkvist
Copy link

cbrunnkvist commented Oct 8, 2024

You can do of course do this on the command line using 7z with e and the -o flag while telling it to extract only the .rsrc/ICON path ...

Example: I just used in order to get my WINEskin Bookworm Adventures shortcut to look proper :)
7z e -oBWA-Icons /Users/conny/Applications/Wineskin/Bookworm\ Adventures\ 2.app/Contents/SharedSupport/prefix/drive_c/Bookworm\ Adventures\ Volume\ 2/BookwormAdventuresVol2.exe .rsrc/ICON

EDIT:

yes I am on macOS, using the Homebrew package p7zip ...

I was using p7zip but as @WinkelCode mentioned, the 7-zip dot org implementation is also available through the sevenzip(aliased as 7zip) package.

@WinkelCode
Copy link

WinkelCode commented Oct 8, 2024

@cbrunnkvist FYI, 7zip has an official Linux/Mac CLI port. The Brew bottle is called sevenzip and the binary is called 7zz. I just tested it and it works the same way for extracting icons.

My understanding is that the official port (sevenzip/7zz) is the preferred program nowadays as it is actively maintained, which is important for stuff like security issues that crop up every now and then.

@farhansolodev
Copy link

This is why I love the internet, thankyou kind strangers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment