How to extract Icons from Windows executeables in Linux

Written by James McDonald

June 9, 2008

I have installed a small app using Wine under Ubuntu 8.04 however the desktop launcher icon isn’t the correct one for the application.

Windows frequently stores application icons in the programs exe file. So to fix my launcher icon I need to extract the icon from the exe.

To extract the icon under Linux:
You need to install icoutils
For Ubuntu:

sudo apt-get install icoutils

For Fedora (Update: 2011-09-24)

yum install icoutils

Others:
Check for and download the latest rpm from http://download.savannah.gnu.org/releases/icoutils/

wget http://download.savannah.gnu.org/releases/icoutils/icoutils-0.26.0-1.i386.rpm
rpm -Uvh icoutils-0.26.0-1.i386.rpm
cd ~/.wine/drive_c/Program Files/;
e.g ~/.wine/drive_c/Program Files/eXeSMS
wrestool -l eXeSMS.exe

You will see heaps of output but look for the line that identifies the icon (from what I understand you need the ‘group_icon’)
e.g.
--type=14 --name='MAINICON' --language=3081 [type=group_icon offset=0x15d6d8 size=20]

Once you have identified your icon you need extract it to a file

wrestool -x -n MAINICON eXeSMS.exe > myicon.ico

#Another way
# this will out put the icon as a name similar to eXeSMS.exe_14_1_0.ico
wrestool -x --output=. --type=14 

Note the use of the > character because by default wrestool sends it to stdout (your console)

What I did then was copy the file to a safe place and then edit my launcher to use the icon file.

Note: You can also open the file in Gimp and change it’s format to whatever you wish

Here is how I got the icons from iexplore.exe:

cd ~/.wine/drive_c/Program Files/Internet\ Explorer
for i in `wrestool -l iexplore.exe | grep group_icon | awk '{ print $2}' | cut -f2 -d=` ; do wrestool -x -n $i  iexplore.exe > $i.ico ; done

9 Comments

  1. Xeon

    When I try install icoutils, get error ‘invalid dependencies’

    $ rpm -Uvh icoutils-0.26.0-1.i386.rpm
    b??d: Niespe?nione zale?no?ci:
    perl(HTTP::Status) jest wymagany przez icoutils-1:0.26.0-1.i386
    perl(LWP::Simple) jest wymagany przez icoutils-1:0.26.0-1.i386

    Reply
  2. Trevor Briere

    … or you could be really lazy and just install something like IcoFX (freeware) under wine and open the .exe with it.

    Reply
    • james

      Excellent tip Trevor. I tried IcoFX and it installs and runs well under wine. Extracting icons with it is easy and exporting to png format works fine.

      Reply
  3. dominik

    No matter what, I just can’t manage to extract utorrent’s icons. I guess thats because the executable is compressed. Nice trick though.

    Reply
    • james

      Try this

      wrestool -n 2 -x -t 14 uTorrent.exe > output_2.ico

      This will create a multi layer ico file. To make it a single image:

      Open in gimp

      select layers dialog
      delete the layers you don’t want
      save the file as an ico or png

      Reply
      • Stephen Eilert

        Or you could install imagemagick and use convert:

        convert name.ico name.png

        This will create several images, if the icon has more than one.

        Reply
        • james

          Nice,
          Thanks for the tip Stephen.

          TIMTOWTODI (There is more than one way to do it)

          Reply
  4. admin

    I don’t understand the language but this guy has created a post showing a geticon script used to automate the process of extracting the icon.

    Reply
  5. Rodders

    Excellent. Works in Ubuntu 14.04 and just takes a little work to select the correct icon.
    Thanks

    Reply

Trackbacks/Pingbacks

  1. Wine Cosmetics - Extract Icons From exe « Strug Blog - [...] Wine Cosmetics - Extract Icons From exe I use Elster on ubuntu to do my tax declaration. After installation wine…

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...