Developer Playbook

Integrate BWConverter Into Your Own Workflow

This guide documents the same WebAssembly pipeline that powers the production app. Use it to embed monochrome processing inside headless CMS builds, kiosk apps, or internal proofing tools while keeping every pixel on-device.

Starter Assets & Sample Pack

Clone the repository or download the starter archive to access workers, preset definitions, and six processed reference frames. The pack pairs colour originals with converter outputs so QA teams can verify tonal accuracy.

Performance Snapshot

All metrics below were captured with the January 2025 build (commit `18f0c22`). Keep track of your own numbers to monitor regressions after custom modifications.

24 MP JPEG (12.3 MB)
M1 MacBook Air • Chrome 121
Preview: 1.6 sExport: 2.4 s

Classic preset + +8 highlights. Deterministic delta-E < 1.2 vs reference TIFF.

42 MP PNG (21.4 MB)
Intel i7-1185G7 • Edge 119
Preview: 2.8 sExport: 4.3 s

Film Noir preset + grain. GPU memory usage stabilises at 420 MB.

Mobile HEIC (3.1 MB)
Pixel 8 Pro • Chrome 120
Preview: 0.9 sExport: 1.3 s

Soft preset with shadow recovery for skin retention.

Preset Matrix (From `DEFAULT_PRESETS`)

PresetContrastBrightnessHighlightsShadowsGrainRecommended Usage
Classic100100000Portrait baseline, editorial proofs
Dramatic16090+10-205Architecture, moody landscapes
Soft80110-5+100Newborn sessions, skin-focused edits
Vintage120950+515Fashion lookbooks, heritage storytelling
High Contrast180100+20-300Product hero shots, poster art
Film Noir15080+15-2520Cinematic campaigns, dramatic portraiture

Need a studio-specific look? Duplicate your preferred preset and persist new values through local storage or your CMS schema. The converter automatically reads custom presets when they follow the same shape.

Embed the Converter in Three Moves

Install Core Modules

Import `DEFAULT_PRESETS`, `DOWNLOAD_FORMATS`, and helper utilities from `@/types/image-processing` and `@/lib/image-format`. These keep preset values consistent between single and batch workers.

import { DEFAULT_PRESETS, DOWNLOAD_FORMATS } from '@/types/image-processing'
import { resolveFileInfo, sanitizeBaseName } from '@/lib/image-format'

Spin Up the Worker

Both `/worker.js` and `/batch-worker.js` rely on the same WebAssembly engine. Instantiate the worker once, cache the reference, and forward filter payloads as shown in `src/app/page.tsx`.

const worker = new Worker('/worker.js')
worker.postMessage({
  imageData,
  contrast: filters.contrast,
  brightness: filters.brightness,
  type: 'preview'
})

Enforce Download Governance

Use `downloadCanvasImage` to cap file size and apply safe filenames. The helper respects max byte targets, which prevents oversized deliverables.

await downloadCanvasImage(canvas, {
  filename: `${sanitizeBaseName(info.baseName)}-bw.${format.value}`,
  mimeType: format.mimeType,
  quality: qualityForFormat(format),
  maxBytes: sameFormat ? info.size : undefined
})

Quality Assurance Checklist

  • Generate a preview and a final export for each preset; compare histograms against the reference pack in `/public/wallpapers/black-and-white-image`.
  • Validate download payloads stay below client-specified limits using the `maxBytes` flag.
  • Log processing times through `performance.now()` to confirm preview turnaround stays under 3 seconds on target hardware.
  • Record the preset + manual slider deltas in session storage so batch jobs can reproduce identical outputs.
Example black and white conversion output
BWConverter Demonstration Frame

Include one or more verified outputs in your own documentation so reviewers can trace the origin of sample imagery.

Launch Your Custom Monochrome Workflow

Whether you are building a newsroom proofing deck or a gallery kiosk, the WebAssembly converter adapts to your stack. Pair it with the batch worker for large exports or integrate it into a headless CMS build pipeline.