docs.rs failed to build win-icon-extractor-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
win-icon-extractor
Extract file icons on Windows — pure Rust, no C dependency.
- Raw RGBA pixels from any file (exe, dll, ico, or shell fallback)
- Extension icons — get associated icon by file extension, no file needed
- System stock icons — folder, drive, recycle bin, shield, etc.
- Icon enumeration — query how many icons a PE file contains
- WebP / PNG encoding with configurable options
- Disk + memory cache with mtime-based staleness detection
- Bulk parallel extraction via rayon
Quick Start
use *;
// Raw RGBA pixels from a file
let icon = extract_icon.unwrap;
println!;
// By index or size
let icon = extract_icon_at.unwrap;
let icon = extract_icon_with_size.unwrap;
// Icon count in a PE file
let count = icon_count; // 335
Extension Icons
Get the associated icon for any file extension — the file does not need to exist:
let icon = extract_icon_for_extension.unwrap;
let icon = extract_icon_for_extension.unwrap;
System Stock Icons
Extract Windows system-defined icons:
use StockIcon;
let icon = extract_stock_icon.unwrap;
let icon = extract_stock_icon.unwrap;
let icon = extract_stock_icon.unwrap;
let icon = extract_stock_icon.unwrap;
// Custom size
let icon = extract_stock_icon_sized.unwrap;
Available stock icons: Folder, FolderOpen, DriveFixed, DriveRemovable, DriveNet, DriveCd, DriveDvd, Recycler, RecyclerFull, Shield, Warning, Error, Info, Internet, Server, Printer, Users, ZipFile, Settings, and more.
Encoding
// WebP (feature = "webp")
let webp = extract_icon_webp.unwrap;
write.unwrap;
// PNG (feature = "png")
let png = extract_icon_png.unwrap;
write.unwrap;
// Encode raw RGBA data
let webp = encode_webp.unwrap;
let png = encode_png.unwrap;
Custom Encoding Options
use *;
// WebP: custom quality, method, lossless mode
let opts = WebPOptions ;
let webp = encode_webp_with.unwrap;
// WebP best quality preset (lossless, max effort)
let webp = encode_webp_with.unwrap;
// PNG: custom filter and compression level
let opts = PngOptions ;
let png = encode_png_with.unwrap;
// PNG best quality preset (max compression, None filter)
let png = encode_png_with.unwrap;
Caching
use ;
let cache = with_app_name.unwrap;
let path = cache.extract_to_file.unwrap;
// Use PNG format instead of WebP
let mut cache = with_app_name.unwrap;
cache.set_format;
// Custom encoding options on cache
cache.set_webp_options;
cache.set_png_options;
// Bulk parallel extraction (returns Result per path)
let paths = &;
let results = cache.extract_to_file_bulk;
for in &results
// Maintenance
let stats = cache.stats.unwrap;
cache.cleanup.unwrap; // remove files older than 30 days
Features
| Feature | Default | Description |
|---|---|---|
webp |
✓ | WebP encoding via libwebp-sys |
png |
PNG encoding (hand-written encoder + miniz_oxide) | |
cache |
✓ | Disk + memory cache with mtime validation |
bulk |
✓ | Parallel extraction via rayon |
# All defaults (webp + cache + bulk)
= "0.1"
# Minimal — raw extraction only
= { = "0.1", = false }
# PNG instead of WebP
= { = "0.1", = false, = ["png", "cache"] }
Performance
Benchmarked on Windows 11, release mode:
| API | Latency |
|---|---|
icon_count |
~40µs |
extract_stock_icon |
~126µs |
extract_icon_for_extension |
~235µs |
extract_icon (file) |
~1.6ms |
| Cache warm hit | ~1.4ms |
License
AGPL-3.0