Crates.io | windows-icons |
lib.rs | windows-icons |
version | |
source | src |
created_at | 2024-09-07 00:18:12.361798 |
updated_at | 2025-02-01 19:15:53.736604 |
description | A simple library to extract icons from files on Windows |
homepage | |
repository | |
max_upload_size | |
id | 1366807 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A simple Rust library to extract icons from files and running processes on Windows platforms.
Add to your Cargo.toml
:
[dependencies]
windows-icons = "0.2.1"
// Get icon as an image from a file path
let icon = get_icon_image_by_path("C:\\Windows\\System32\\notepad.exe").unwrap();
icon.save("notepad.png").unwrap();
// Get icon as a base64 string from a file path
let base64 = get_icon_base64_by_path("C:\\Windows\\System32\\calc.exe").unwrap();
println!("Calculator icon: {}", base64);
// Get icon as an image from a process ID
let process_id = 1234;
let icon = get_icon_image_by_process_id(process_id).unwrap();
icon.save("process.png").unwrap();
// Get icon as a base64 encoded string from a process ID
let base64 = get_icon_base64_by_process_id(process_id).unwrap();
println!("Process {} icon: {}", process_id, base64);
For more examples, check the examples/main.rs
.
This library is designed to work on Windows systems only.
This project is licensed under the MIT License - see the LICENSE
for details.
Contributions are welcome! Please feel free to submit a Pull Request.
This library uses the following crates:
image
for image processingbase64
for base64 encodingglob
for matching file pathswinapi
and windows
for Windows API interactionsThis library uses unsafe Rust code to interact with the Windows API. While efforts have been made to ensure safety, use it at your own risk.