Skip to content

KimboPulus/Parallel-image-processor-rust

Repository files navigation

Parallel Image Processor

Parallel Image Processor is a small Rust desktop app about making image work feel concrete. It keeps the interface simple, then spends the interesting energy on how pixels move through a multithreaded pipeline.

It opens common image files, applies filters, and splits the image rows across worker threads. The command line tool still reads and writes binary PPM images for small experiments, while the desktop app is the comfortable way to try it with normal photos.

Run It

Rust 1.92 or newer is required.

Desktop app:

cargo run --release --bin desktop

PPM command line:

cargo run --release -- input.ppm output.ppm --filter grayscale --filter blur:2 --threads 4

Screenshots

Desktop app processing a photo

What It Can Do

  • Apply invert, grayscale, brightness, threshold, and blur filters.
  • Open PNG, JPEG, and BMP images in the desktop app.
  • Save the processed result as a PNG file.
  • Chain filters so the output of one stage becomes the input of the next.
  • Divide rows fairly across workers, even when the image height does not split evenly.
  • Process blur safely by reading from one image while writing into a separate output image.
  • Report how many workers were used for each filter stage.

Interesting Details

The image buffer is flat: one Vec<Pixel> stores pixels row by row. That makes it easy to hand each worker a different mutable slice of the output. Threads do not fight over the same pixels, and the source image is shared read-only.

Blur is the most useful teaching filter in the project. A pixel needs to look at its neighbors, so the code cannot simply edit the image in place. That separation between input and output is the quiet trick that keeps the threaded version deterministic.

PPM is still used in the command line path because it is small enough to understand at a glance. The desktop app adds normal photo formats around the same processing core, so the useful part of the project stays in one place.

Project Map

  • src/pixel.rs keeps small RGB color operations.
  • src/image.rs owns dimensions and the pixel buffer.
  • src/codec.rs loads and saves common image files.
  • src/plan.rs decides which rows each worker receives.
  • src/filters.rs defines the filters and their text names.
  • src/processor.rs runs filters with scoped threads.
  • src/ppm.rs reads and writes the image format.
  • src/bin/desktop.rs contains the desktop app.
  • tests/pipeline.rs checks the full library flow.

Engineering Checks

cargo fmt --all -- --check
cargo test --locked --lib --bins --tests
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo build --locked --release --bins

GitHub Actions runs strict quality checks and release builds across Windows, Linux, and macOS. It also checks declared Rust 1.92 minimum version.

Performance Evidence

Processing library includes serial reference implementation. Tests require serial and parallel paths to produce identical results. Criterion suite compares both paths using point and neighborhood filters:

cargo bench --bench processing

Current i7-8700 baseline reaches 3.11x speedup for 1080p grayscale and 3.90x for radius-2 blur with eight workers. Benchmark design, full results, and environment live in docs/benchmarking.md. Concurrency invariants and current tradeoffs live in docs/architecture.md.

Project Policies

About

Cross-platform Rust desktop app for parallel image processing.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages