Skip to content

v0.1.0

Choose a tag to compare

@Lockyc Lockyc released this 01 Oct 14:51
· 33 commits to main since this release

imgkit is a Go CLI of image and render operations for print and web pipelines. Each command wraps a pinned engine, and its quality is measured against a committed set of test images.

Commands

  • cutout: lifts the subject out of an image as RGBA, down to hair and fur. --coarse vision (Apple Vision) or --coarse birefnet picks the first-pass mask; despill flags remove background colour from edges.
  • inpaint: fills a masked region with LaMa. Creates pixels, so it honours synthesis = "forbid" in imgkit.toml.
  • infill: fills a hole in a flat ground by blending blurred copies of its surroundings, then lays the ground's own grain over it. Honours the synthesis policy.
  • upscale: enlarges 4x with DAT, sharpening what the small image holds rather than inventing texture. Honours the synthesis policy.
  • grade fit: recovers a reference image's colour grade as a lookup table, ignoring excluded regions and requiring a minimum of inlier pixels.
  • grade apply: applies that lookup table, keeping transparency.
  • render: HTML to PNG or PDF with chrome-headless-shell; refuses unverified sizes, stamps print DPI, fails on Letter pages and on --fail-if text.
  • press: converts a PDF to a print master (text as outlines, CMYK colour) and checks it against a soft proof, failing if the result drifts past the thresholds.
  • diff: compares two images after lining them up, so a small shift does not fail everything.
  • fonts: embeds web fonts into a CSS file so a page renders from the filesystem.
  • qr: makes a QR code SVG that any phone camera decodes.
  • doctor: checks every engine against its pin, installs the ones imgkit manages, and prints the install command for the rest.
  • version: prints imgkit's version.

imgkit <command> -h lists each flag with its default.

Getting started

go install github.com/lockyc/imgkit@v0.1.0
imgkit doctor --install

Needs

  • uv for the ML commands (cutout, inpaint, upscale, grade fit). The first run of each downloads its Python dependencies and model weights, several GB on Linux, into the uv, Hugging Face, rembg and PyTorch caches.
  • Every other engine is checked by imgkit doctor.
  • IMGKIT_DEVICE=cpu|mps|cuda chooses the PyTorch device.

Platforms

  • Apple Silicon, macOS 14 or later: every command.
  • Linux, glibc 2.28 or later, x86_64 or arm64: every command except cutout --coarse vision; cutout defaults to --coarse birefnet there. On arm64, render needs a chrome-headless-shell supplied via IMGKIT_ENGINE_CHROME_HEADLESS_SHELL. render also needs the usual Chrome shared libraries (such as libnss3) from the distribution; doctor does not check for them yet.
  • Intel Macs: the torch-backed commands (cutout, upscale) refuse to run; grade fit needs macOS 14 or later; inpaint is untested.

The quality cases were measured on Apple Silicon (MPS).