Skip to main content
Requirements: Rust ≥ 1.74 and Go ≥ 1.23 must be installed before you begin. For video and audio operations, FFmpeg 6.0+ is also required. Static builds on Linux additionally need musl-tools.
1

Clone and build

Clone the repository and run the full build. This compiles the Rust engine and the Go example binary.
git clone https://github.com/GustavoGutierrez/devpixelforge.git
cd devpixelforge
make build
The make build target runs build-rust followed by build-go. The Rust release binary is written to dpf/target/release/dpf.
To build only the Rust engine without the Go example, run make build-rust instead.
2

Verify the binary

Confirm the engine is working by printing its capability report:
./dpf/target/release/dpf caps
You should see a JSON object listing all supported operations, formats, and engine metadata. If the command exits cleanly, your installation is ready.
3

Resize an image with the CLI

Run your first resize operation directly from the command line using the process subcommand:
./dpf/target/release/dpf process \
  --job '{"operation":"resize","input":"image.png","output_dir":"out","widths":[320,640]}'
This produces two files in the out/ directory — one at 320 px wide and one at 640 px wide — while preserving aspect ratio.
./dpf/target/release/dpf process \
  --job '{"operation":"resize","input":"image.png","output_dir":"out","widths":[320,640,1024]}'
The response is a JSON object on stdout:
{
  "success": true,
  "operation": "resize",
  "outputs": [
    {"path": "out/image-320.png", "format": "png", "width": 320, "height": 213, "size_bytes": 14320},
    {"path": "out/image-640.png", "format": "png", "width": 640, "height": 427, "size_bytes": 42180}
  ],
  "elapsed_ms": 38
}
4

Resize an image with the Go client

Copy the Go bridge files into your project and call the client from your Go code.First, set up the directory layout:
mkdir -p bin internal/dpf
cp devpixelforge/dpf/target/release/dpf ./bin/dpf
cp devpixelforge/go-bridge/dpf.go ./internal/dpf/
cp devpixelforge/go-bridge/job.go ./internal/dpf/
cp devpixelforge/go-bridge/video_job.go ./internal/dpf/
cp devpixelforge/go-bridge/audio_job.go ./internal/dpf/
Then call Resize from your Go code:
package main

import (
    "context"
    "fmt"
    "log"
    "time"
    "your-project/internal/dpf"
)

func main() {
    client := dpf.NewClient("./bin/dpf")
    client.SetTimeout(60 * time.Second)

    result, err := client.Resize(
        context.Background(),
        "image.png",
        "out",
        []uint32{320, 640, 1024},
    )
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Done in %dms — %d files produced\n",
        result.ElapsedMs, len(result.Outputs))

    for _, f := range result.Outputs {
        fmt.Printf("  %s (%dx%d, %d bytes)\n",
            f.Path, f.Width, f.Height, f.SizeBytes)
    }
}
For high-throughput applications — such as a web server processing many images concurrently — use StreamClient instead. It keeps the Rust process alive and reuses it across requests:
sc, err := dpf.NewStreamClient("./bin/dpf")
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

result, err := sc.Execute(&dpf.ResizeJob{
    Operation: "resize",
    Input:     "image.png",
    OutputDir: "out",
    Widths:    []uint32{320, 640, 1024},
})
StreamClient.Execute is thread-safe. You can call it from multiple goroutines concurrently — the client serializes access to the underlying stdin/stdout pipe with a mutex.

Next steps

Installation

Full installation guide including static builds and system requirements

Go integration

Detailed guide for embedding dpf into any Go project

Streaming client

Persistent process mode for low-latency, high-throughput workloads

Image operations

Full reference for all 14 image operations

Build docs developers (and LLMs) love