Extract icons from Windows EXE/DLL files and create macOS ICNS files
Project description
Exe2Iconset
Cross-platform tool to extract icons from Windows EXE/DLL files, image files, or directories and create macOS ICNS files.
Installation
From PyPI (recommended)
pip install exe2iconset
From source
pip install .
Or install in development mode:
pip install -e .
Requirements
- Python >= 3.10
- Pillow >= 10.0.0
- pefile >= 2023.2.7
Usage
GUI
Run the GUI application:
# After pip install
exe2iconset-gui
# Or with python -m
python -m exe2iconset
Or import and run:
from exe2iconset import run_gui
run_gui()
GUI Workflow
- Select Input File: Click "Browse..." or enter path and press Enter
- Extract Icons: Extraction starts automatically after file selection. A progress bar shows extraction progress.
- Select Series: Choose an icon series from the Treeview list
- Create ICNS: Enter output name and click "Create ICNS"
- Save Location: ICNS file will be saved in the selected output directory
The icon list shows compact details like ID:101, LANG:1033, all:64²×32bit where:
- ID: Resource ID (e.g., 101)
- LANG: Language code (e.g., 1033 = English)
- all: All sizes in the group (e.g., 64²×32bit means 64x64 at 32-bit color)
Click the status bar to view the full activity log in a popup window.
CLI
# Using the installed command
exe2iconset <file.exe> --list
# Or with python -m
python -m exe2iconset <file.exe> --list
# Create ICNS from specific group (PE files)
exe2iconset <file.exe> -g icongroup_47_1033 -o output.icns
# Create ICNS from image file
exe2iconset <image.png> -o output.icns
# Create ICNS with iconset directory for inspection
exe2iconset <file.exe> -o output.icns --iconset
# Verbose output for debugging
exe2iconset <file.exe> -v
CLI Options
| Option | Description |
|---|---|
-l, --list |
List available icon groups and exit |
-g, --group GROUP |
Icon group to use (e.g., icongroup_3_1033) |
-o, --output FILE |
Output ICNS file (default: appicon.icns) |
--iconset |
Also create iconset directory |
-v, --verbose |
Enable verbose output |
Python API
from exe2iconset import extract_images, create_icns_from_images, convert_icons_to_icns_sizes, ICON_TYPE_MAP
# Extract icons/images from PE file, image file, or directory
# Returns dict mapping group name to list of icon dicts
icon_groups = extract_images("app.exe") # PE file
icon_groups = extract_images("image.png") # Single image
icon_groups = extract_images("images/") # Directory
# Get the first group (or specific group by name)
first_group_key = list(icon_groups.keys())[0]
icon_data_list = icon_groups[first_group_key]
# Convert extracted icons to PIL images with resolutions, suitable for ICNS
mac_icon_sizes = list(ICON_TYPE_MAP.keys())
icon_images = convert_icons_to_icns_sizes(icon_data_list, mac_icon_sizes)
# Create ICNS from images
create_icns_from_images(icon_images, "app.icns")
# Also you can save images as iconset directory
save_iconset(icon_images, "app.iconset")
ICNS Format
The application creates ICNS files with these standard macOS icon types:
| Type | Size | Format | Notes |
|---|---|---|---|
| ic04 | 16×16 | ARGB | PackBits compressed |
| ic05 | 32×32 | ARGB | PackBits compressed |
| icp6 | 48×48 | PNG | |
| ic12 | 64×64 | PNG | Can serve as 32@2x retina |
| ic07 | 128×128 | PNG | |
| ic08 | 256×256 | PNG | |
| ic09 | 512×512 | PNG | |
| ic10 | 1024×1024 | PNG | Can serve as 512@2x retina |
Notes on ICNS
- ARGB format (ic04/ic05) preserves alpha channel correctly
- PNG format is used for larger icons
- Retina versions are handled automatically by macOS - no need to create explicit @2x variants
- The ICNS format is flexible - only the sizes available from the source are included
For details on ICNS format, see:
Testing
Run tests with pytest:
# Install test dependencies
pip install exe2iconset[dev]
# Or install from source with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
Known Issues
Drag and Drop on macOS with Tcl/Tk 9.x
If the GUI fails to start with an error like "RuntimeError: Unable to load tkdnd library" or "this extension is compiled for Tcl 8.x", this indicates a Tcl/Tk version incompatibility.
Problem: tkinterdnd2's tkdnd extension is compiled for Tcl 8.x, but macOS with Homebrew may have Tcl/Tk 9.x linked by default.
Solution: Download and replace tkdnd binaries with Tcl 9.x compatible ones:
-
Download from https://github.com/petasis/tkdnd/releases:
- For Apple Silicon (M1/M2/M3):
tkdnd-2.9.5-macOS-tcl9.0-arm64-x64-14.2.1.tgz - For Intel Macs:
tkdnd-2.9.5-macOS-tcl9.0-x86_64-x64-14.2.1.tgz
- For Apple Silicon (M1/M2/M3):
-
Extract the archive and copy contents to your tkinterdnd2 installation:
# Find your tkinterdnd2 location python -c "import tkinterdnd2; print(tkinterdnd2.__file__)" # Navigate to tkdnd folder and replace files from the archive # The archive contains osx-arm64/ or osx-x64/ folder with: # - libtkdnd2.X.X.dylib (the binary) # - pkgIndex.tcl # - *.tcl files
Alternatively, try linking Tcl/Tk 8.x via Homebrew (may require rebuilding your virtual environment):
brew install tcl-tk@8
brew unlink tcl-tk
brew link tcl-tk@8
Drag and Drop on Linux/Wayland
On some Linux distributions running Wayland, drag-and-drop from file managers may work inconsistently (sometimes fires, sometimes doesn't). This is a known tkinterdnd2 limitation with Wayland's inter-app DnD protocol.
Workaround: Use the "Browse..." button to select files, or try running with X11 session instead of Wayland.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exe2iconset-0.2.2.tar.gz.
File metadata
- Download URL: exe2iconset-0.2.2.tar.gz
- Upload date:
- Size: 6.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
775b7513e50715a6c577fdd41286b2531052edd0b315b863b1c543e57bbe4d06
|
|
| MD5 |
e9584c5817f90ac1469ab18dec789285
|
|
| BLAKE2b-256 |
e8da9ee576fc4e07be0a3c3a3dbe6d987ef7eefb68d97c5c542ad903f58441de
|
Provenance
The following attestation bundles were made for exe2iconset-0.2.2.tar.gz:
Publisher:
publish.yml on anakham/Exe2Iconset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
exe2iconset-0.2.2.tar.gz -
Subject digest:
775b7513e50715a6c577fdd41286b2531052edd0b315b863b1c543e57bbe4d06 - Sigstore transparency entry: 1630894261
- Sigstore integration time:
-
Permalink:
anakham/Exe2Iconset@db757a159f655111454bdbc07dec0db9b9f07107 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/anakham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db757a159f655111454bdbc07dec0db9b9f07107 -
Trigger Event:
push
-
Statement type:
File details
Details for the file exe2iconset-0.2.2-py3-none-any.whl.
File metadata
- Download URL: exe2iconset-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49b6b10d797761378b29d4d77552e26b567ff8fc8c339b8bab1085094f97ecb5
|
|
| MD5 |
03d3f773f8bcf0b0fe37c989eb3df905
|
|
| BLAKE2b-256 |
c9b4f1781d15eb93250f4f8ca608051574571960fbed99016568987153d6be00
|
Provenance
The following attestation bundles were made for exe2iconset-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on anakham/Exe2Iconset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
exe2iconset-0.2.2-py3-none-any.whl -
Subject digest:
49b6b10d797761378b29d4d77552e26b567ff8fc8c339b8bab1085094f97ecb5 - Sigstore transparency entry: 1630894334
- Sigstore integration time:
-
Permalink:
anakham/Exe2Iconset@db757a159f655111454bdbc07dec0db9b9f07107 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/anakham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db757a159f655111454bdbc07dec0db9b9f07107 -
Trigger Event:
push
-
Statement type: