cink
Prepare handwritten signature images for correspondence.
Recognize PNG, JPEG, and SVG input, inspect raster dimensions, calculate an aspect-preserving size, and generate a Typst image call. Runs without an image-decoding library.
import from '@corbet-labs/cink';
;
// #image("/signature.png", height: 31.5pt)
Install
| Environment | Command |
|---|---|
| Rust / Cargo | cargo add cink |
| Python / pip | python -m pip install cink |
| Python / uv | uv add cink |
| Node.js / npm | npm install @corbet-labs/cink |
| pnpm | pnpm add @corbet-labs/cink |
| Yarn | yarn add @corbet-labs/cink |
| Bun | bun add @corbet-labs/cink |
| Deno | deno add npm:@corbet-labs/cink |
The 0.1.4 JavaScript distribution includes compiled ESM, CommonJS, TypeScript declarations, and a standalone browser module. Node.js 20+ is supported; no TypeScript loader is required.
// CommonJS
const = require;
Python 3.10+ packages are available on PyPI. See the installation guide for CLI commands and other distribution options. JSR publication and Typst availability are listed there explicitly.
Rust
use image_snippet;
assert_eq!;
Python
assert ==
API
| JavaScript / Python or Rust | Purpose |
|---|---|
normalize |
Recognize a base64 image or data URL |
exceedsLimits / exceeds_limits |
Check a raster pixel budget |
scaleToFit / scale_to_fit |
Calculate a downscaling factor |
signatureSize / signature_size |
Fit dimensions to a point size |
imageSnippet / image_snippet |
Generate a Typst image call |
Base64 input uses the standard alphabet, required padding, and canonical trailing bits; embedded whitespace is rejected.
PNG and JPEG dimensions are read from headers; this is not a full raster integrity check. SVG passes through without sanitization or known dimensions. Unrecognized headers and unsupported formats return null/None. Nonpositive, nonfinite, and unrepresentable requested sizes return null/None. Resampling and placement belong to the caller. These are handwriting images, not cryptographic or electronic signatures.
Correspondence family
| Library | Responsibility |
|---|---|
| cletter | Compose the correspondence helpers |
| cgreet | German salutations and titles |
| cfarewell | Locale-specific closings |
| cdate | Calendar-date formatting |
| cink | Handwritten signature images |
Development
Behavior is defined by the signature limits and shared conformance vectors. Rust, JavaScript, and Python run the same vectors. Selected CI checks exercise installed JavaScript tarballs, Python wheels and command-line entrypoints, and Typst packages. Release validation records the actual runtime and platform; Linux results do not establish native Windows or macOS coverage. All five Rust crates forbid unsafe code in their own source.
See the release guide for generation, verification, and publication commands.
License
Copyright 2026 Julian Y. Richard Corbet. The 0.2.1 release line is licensed under LGPL-3.0-only WITH LGPL-3.0-linking-exception, with the incorporated GPL version 3. Combined works may link statically or dynamically without relinking duties; library modifications stay LGPL. Applications can use a different license subject to the LGPL's conditions. Version 0.1.4 retains Apache-2.0. The installation examples above refer to those available releases; 0.2.1 is published to registries.
See the licensing notes for distribution conditions and retained notices. Contributions use the Contributor License Agreement.