imx
A Rust library for image processing and manipulation, providing functionality for letterbox removal, transparency handling, and JXL format support.
Features
- 🖼️ Image Processing
- Remove letterboxing from images with configurable threshold
- Remove transparency (convert to black)
- Get image dimensions
- Process images in batches
- 📸 Format Support
- JPEG/JPG
- PNG
- WebP
- JXL (JPEG XL) with automatic PNG conversion
- 🛠️ Utilities
- File type detection
- Async/await support
- Error handling with context
- Detailed logging
- Safe numeric type conversions (f32 ↔ i32 ↔ u32 ↔ u8)
Installation
Add this to your Cargo.toml
:
[]
= "0.1.2"
Usage Examples
Remove Letterboxing
use ;
use Result;
async
Process JXL Images
use ;
use Result;
async
Remove Transparency
use remove_transparency;
use Result;
async
Get Image Dimensions
use get_image_dimensions;
use Result;
Safe Numeric Conversions
use ;
Check File Types
use ;
Error Handling
All functions return Result
types with detailed error context:
use remove_letterbox_with_threshold;
use ;
async
Testing
Run the test suite:
The test suite includes:
- Unit tests for all major functions
- Integration tests with sample images
- Error handling tests
- Format-specific tests (JXL, PNG, etc.)
- Numeric conversion tests
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.