Features
- Multiple Image Formats: Complete support for grayscale, grayscale with alpha, RGB, and RGBA images
- Type Flexibility: Generic implementation for various component types (
u8,f32,f64, etc.) - Image Manipulation: Comprehensive operations for regions, borders, and transformations
- Tiling Operations: Create, extract and compose image tiles with or without overlaps
- Image Composition: Stack images horizontally and vertically
- Advanced Indexing: Access and modify pixels and channels with ease
- Comprehensive Testing: High test coverage ensures library reliability
- Minimal Dependencies: Core functionality relies on few, well-maintained dependencies
Installation
Add this to your Cargo.toml:
[]
= "3.0.0"
Usage
Basic Image Operations
use ;
// Create a new empty RGB image with f32 components
let mut image = empty;
// Fill an image with a specific color
let red_image = filled;
// Access and modify pixel values
let pixel = image.get_pixel;
image.set_pixel;
// Get a specific channel
let red_channel = image.get_channel;
Image Transformations
use Image;
// Create a new image from multiple layers
let layers = vec!;
let mut image = from_layers;
// Move pixels around (with wrapping)
image.slide_inplace;
// Copy a region of the image
let region = image.copy_region;
Working with Tiles
use Image;
// Split an image into tiles (non-overlapping)
let tile_size = ;
let no_overlap = ;
let tiles = image.copy_tiles;
// Create an image from a grid of tiles
let combined_image = stack;
// Extract tiles with overlap
let overlap = ;
let overlapping_tiles = image.copy_tiles;
Working with Borders
use Image;
use Direction;
// Get a view of the border regions
let north_border = image.view_border;
let south_border = image.view_border;
// Copy border regions
let east_border = image.copy_border;
let west_border = image.copy_border;
// View or copy the interior (excluding borders)
let interior = image.copy_interior;
Composing Images
use Image;
// Stack images vertically
let vertical_stack = vstack;
// Stack images horizontally
let horizontal_stack = hstack;
Applications
This library is useful for:
- Image processing and manipulation
- Computer vision
- Pattern recognition
- Procedural texture generation
- Image-based machine learning
- Tile-based graphics
- Cellular automata and grid-based simulations
License
This project is licensed under the MIT License - see the LICENSE file for details.