ICU-LIB
Image Converter Ultra Library (ICU-LIB) is the reusable format and image-processing library behind the icu command-line tool and viewer.
Features
- Decode and encode common raster image formats.
- Decode and encode LVGL v8/v9 image data.
- Decode and encode MIRX flat images, scenes, indexed images, and font chunks.
- Parse TTF, OTF, and TTC font outlines and metadata.
- Import and export SVG scene data.
- Provide reusable image post-processing, quantization, dithering, and diff helpers.
Usage
cargo add icu_lib
The library uses MiData as the shared representation between format implementations:
input bytes -> EnDecoder::decode -> MiData -> EnDecoder::encode -> output bytes
A minimal conversion example:
use ;
use MiData;
use EncoderParams;
use fs;
EncoderParams also supports dithering, LVGL compression, and raw image header options. See the public API and the main repository README for the current CLI-level examples.
Architecture
╔═══════════════╗
║ ║
║ ║
┌ ─ ─ ─ ─ ─ ─ ┐ ║
┌ ─ ─ ─ ─ ┐ ║
│ EnDecoder │ ▼
└ ─ ─ ─ ─ ┘ ┌ ─ ─ ─ ─ ─ ─ ┐
│┌───────────┐│ ┌ ─ ─ ─ ─ ┐
│ PNG │ │ MidData │
│└───────────┘│ └ ─ ─ ─ ─ ┘
┌───────────┐ │┌───────────┐│
││ JPEG ││ │ ARGB │
└───────────┘ │└───────────┘│ ╔-------------╗
│┌───────────┐│ ┌───────────┐ ║ ICU_LIB ║
│ SVG │ ││ PATH ││ ╚-------------╝
│└───────────┘│ └───────────┘
┌───────────┐ │┌── ─── ─── ┐│
││ LVGL BIN ││ CUSTOM │
└───────────┘ │└── ─── ─── ┘│
│┌── ─── ─── ┐│ ─ ─ ─ ─ ─ ─ ─
CUSTOM │ ║
│└── ─── ─── ┘│ ║
─ ─ ─ ─ ─ ─ ─ ║
▲ ║
║ ║
╚═══════════════╝
The main modules are:
endecoder/: format-specific implementations and automatic detection.midata/: shared RGBA, grayscale, path, font, and indexed-image models.postprocess/: reusable image transformations.
When adding a format, keep format-specific knowledge in endecoder, use an existing MiData variant when it can represent the data correctly, register automatic detection when appropriate, and add focused tests. See CONTRIBUTING.md for the complete integration checklist.
License
ICU-LIB is licensed under the MIT license.