BMP Rust
BMP Rust is a rust library to read and write .bmp Image files. It has zero dependencies.
Install
Obviously, install Rust. Add bmp-rust to your Cargo.toml file
[]
="0.2.6"
You can now use the crate:
use BMP;
Documentation
The docs.rs page contains documentation for all functions and types in this library.
First, load a BMP file by file path, or create a new one:
let mut bmp_from_file = BMP new_from_file;
let mut bmp_from_scratch = BMP new;
Information can now be read from the file:
let file_size = bmp_from_file.get_size;
let dib_header = bmp_from_file.get_dib_header.unwrap;
let width = dib_header.width;
let height = dib_header.height;
let pixel_color = bmp_from_file.get_color_of_px.unwrap;
Or new pixel data can be written to it:
bmp_from_file.change_color_of_pixel.expect;
bmp_from_file.fill_bucket.expect;
bmp_from_file.draw_line.expect;
bmp_from_file.draw_rectangle.expect;
bmp_from_file.draw_ellipse.expect;
bmp_from_file.invert.expect;
bmp_from_file.change_opacity.expect;
bmp_from_file.draw_image.expect;
bmp_from_file.translate;
Look at the source code or tests/example for more functions, and their usage.