# How to Install hzbd/imagekit: Build from Source or Use Pre-compiled Binaries

> Easily install hzbdimagekit by building from source with cargo build or downloading pre-compiled binaries from GitHub Releases. Get started with imagekit today.

- Repository: [hzbd/imagekit](https://github.com/hzbd/imagekit)
- Tags: getting-started
- Published: 2026-03-03

---

**You can install hzbd/imagekit by either compiling the Rust source code with `cargo build --release` or downloading pre-compiled binaries from the GitHub Releases page.**

hzbd/imagekit is a fast, parallel command-line tool for batch image processing written in Rust. This guide covers the complete installation process, from system requirements to verification, based on the actual source code structure found in the repository.

## Prerequisites

Before installing hzbd/imagekit, ensure your system meets the minimum requirements. The project requires **Rust 1.87 or newer** to compile from source. Install Rust and Cargo by following the official guide at [rust-lang.org/tools/install](https://www.rust-lang.org/tools/install).

## Method 1: Build from Source

Compiling from source ensures you have the latest version from the `master` branch and optimizes the binary for your specific architecture.

Clone the repository to your local machine:

```bash
git clone https://github.com/hzbd/imagekit.git
cd imagekit

```

Build the binary in release mode for optimal performance. The [`Cargo.toml`](https://github.com/hzbd/imagekit/blob/main/Cargo.toml) file defines the project dependencies including `clap` for CLI parsing, `image` for image processing, and `rayon` for parallelization:

```bash
cargo build --release

```

The compiled executable appears at `target/release/imagekit`. This binary contains the full CLI implementation defined in [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs) and the processing logic orchestrated in [`src/lib.rs`](https://github.com/hzbd/imagekit/blob/main/src/lib.rs).

## Method 2: Install Pre-compiled Binaries

For users who prefer not to install Rust or wait for compilation, the repository provides ready-made binaries. Visit the **Releases** page on GitHub to download the appropriate archive for Windows, macOS, or Linux.

Extract the archive and move the `imagekit` executable to a directory in your system `PATH`, such as `/usr/local/bin` on Linux/macOS or a directory added to your environment variables on Windows.

## Verify Your Installation

Confirm the installation succeeded by checking the CLI help output. This validates that the binary correctly parses arguments as defined in [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs):

```bash
./target/release/imagekit --help

```

You should see the complete list of supported flags including input/output directories, dimensions, watermark settings, and quality controls.

## Embedding ImageKit in Rust Projects

The crate exposes a public library interface through [`src/lib.rs`](https://github.com/hzbd/imagekit/blob/main/src/lib.rs), allowing you to integrate the batch processing pipeline into your own Rust applications instead of using the CLI.

Add the dependency to your [`Cargo.toml`](https://github.com/hzbd/imagekit/blob/main/Cargo.toml) and use the `run` function with a programmatically constructed `Cli` struct:

```rust
use imagekit::{run, cli::Cli};
use std::path::PathBuf;

fn main() -> anyhow::Result<()> {
    let cli = Cli {
        input_dir: PathBuf::from("example/img-src"),
        output_dir: PathBuf::from("example/img-out"),
        width: Some(800),
        height: None,
        watermark_text: Some("Sample".into()),
        watermark_position: Default::default(),
        font_size: 24,
        watermark_color: Default::default(),
        quality: 85,
        output_format: None,
    };
    run(cli)
}

```

This approach invokes the same parallel processing engine used by the CLI binary defined in [`src/main.rs`](https://github.com/hzbd/imagekit/blob/main/src/main.rs), including font loading from [`src/assets.rs`](https://github.com/hzbd/imagekit/blob/main/src/assets.rs) and image manipulation logic from [`src/processor.rs`](https://github.com/hzbd/imagekit/blob/main/src/processor.rs).

## Summary

- **Rust 1.87+** is required to build hzbd/imagekit from source using `cargo build --release`.
- The compiled binary outputs to `target/release/imagekit` and includes all CLI functionality defined in [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs).
- Pre-compiled binaries for Windows, macOS, and Linux are available on the GitHub Releases page for immediate use.
- The project functions as both a standalone CLI tool and a Rust library via the public `run` function in [`src/lib.rs`](https://github.com/hzbd/imagekit/blob/main/src/lib.rs).
- Verification requires running the binary with `--help` to confirm proper argument parsing.

## Frequently Asked Questions

### What Rust version is required to compile hzbd/imagekit?

The source code requires **Rust 1.87 or newer** as specified in the build configuration. This version ensures compatibility with the dependencies declared in [`Cargo.toml`](https://github.com/hzbd/imagekit/blob/main/Cargo.toml), including the `clap` CLI parser and `rayon` parallelism library.

### Where is the compiled binary located after building from source?

When you run `cargo build --release`, Cargo places the optimized binary at `target/release/imagekit` relative to the project root. This executable is ready to run immediately without additional installation steps.

### Can I use hzbd/imagekit as a library in my own Rust code?

Yes. The crate exposes a public API through [`src/lib.rs`](https://github.com/hzbd/imagekit/blob/main/src/lib.rs) that includes the `run` function and `Cli` struct. You can construct a `Cli` instance programmatically and pass it to `run` to execute the batch processing pipeline directly within your application, bypassing the command-line interface defined in [`src/main.rs`](https://github.com/hzbd/imagekit/blob/main/src/main.rs).

### Do I need to install the pre-compiled binary to a specific location?

While not strictly required, you should place the `imagekit` executable in a directory listed in your system's `PATH` environment variable. This allows you to invoke the tool from any terminal location without specifying the full path to the binary.