https://github.com/nusu-github/imageops-kit
https://github.com/nusu-github/imageops-kit
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nusu-github/imageops-kit
- Owner: nusu-github
- License: apache-2.0
- Created: 2025-06-13T15:57:20.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-05T06:42:42.000Z (6 months ago)
- Last Synced: 2025-09-05T08:31:15.157Z (6 months ago)
- Language: Rust
- Size: 262 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# imageops-kit
A Rust library for image processing operations and utilities.
[](https://crates.io/crates/imageops-kit)
[](https://docs.rs/imageops-kit)
[](LICENSE-APACHE)
[](LICENSE-MIT)
## Overview
This crate provides a collection of image processing operations and utilities.
### Key Features
- **Alpha Pre-multiplication**: Premultiplies alpha values across color channels
- **Alpha Mask Application**: Applies a grayscale mask to an RGB image to generate an RGBA image
- **Blur-Fusion Foreground Estimation**: Estimates the foreground using the Blur-Fusion algorithm
- **Boundary Clipping**: Automatically detects and clips to the minimum boundary
- **Padding**: Smart padding at various positions
- **NL-Means Denoising**: Noise reduction utilizing similarity between neighboring pixels
- **One-Sided Box Filter**: Edge-preserving smoothing filter for image denoising
- **INTER_AREA Resize**: High-quality image downscaling using OpenCV's INTER_AREA algorithm
## Usage Example
```rust
use imageops_kit::{PremultiplyAlphaAndDropExt, ApplyAlphaMaskExt, PaddingExt, Position, OneSidedBoxFilterExt, InterAreaResizeExt};
use imageproc::definitions::Image;
use image::{Rgb, Rgba, Luma};
# fn example() -> Result<(), Box> {
// Premultiplied conversion from RGBA to RGB image
let rgba_image: Image> = Image::new(100, 100);
let rgb_image = rgba_image.premultiply_alpha_and_drop()?;
// Apply alpha mask to RGB image
let rgb_image: Image> = Image::new(100, 100);
let mask: Image> = Image::new(100, 100);
let rgba_result = rgb_image.apply_alpha_mask(&mask)?;
// One-Sided Box Filter for edge-preserving smoothing
let image: Image> = Image::new(100, 100);
let smoothed = image.one_sided_box_filter(2, 5)?; // radius=2, iterations=5
// INTER_AREA resize for high-quality downscaling
let image: Image> = Image::new(100, 100);
let resized = image.resize_area(50, 50)?;
// Image padding
let image: Image> = Image::new(50, 50);
let (padded, position) = image.add_padding(
(100, 100),
Position::Center,
Rgb([255, 255, 255])
)?;
# Ok(())
# }
```
## Installation
Add the following to your `Cargo.toml`:
```toml
[dependencies]
imageops-kit = "0.1"
```
## Documentation
For detailed API specifications, see [docs.rs](https://docs.rs/imageops-kit).
## References
- **Blur-Fusion**: A. Germer, "Approximate Fast Foreground Colour Estimation," ICIP 2021.
## Contribution
We welcome bug reports and pull requests. Please contact us via
the [issue tracker](https://github.com/nusu-github/imageops-kit/issues) on GitHub.
## License
This project is published under the MIT or Apache-2.0 license.