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 { imageSnippet } from '@corbet-labs/cink';
imageSnippet('/signature.png', 31.5);
// #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 { imageSnippet } = require('@corbet-labs/cink');
<script type="module">
import { imageSnippet } from 'https://cdn.jsdelivr.net/npm/@corbet-labs/cink@0.1.4/dist/browser.js';
console.log(imageSnippet('/signature.png', 31.5));
</script>
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 cink::image_snippet;
assert_eq!(image_snippet("/signature.png", 31.5, None), "#image(\"/signature.png\", height: 31.5pt)");
Typst in Rust hosts
The crate also ships the Typst package. Applications that embed the Typst
compiler can register it from cink::typst instead of downloading or
vendoring a copy, so Rust and Typst always come from the same release.
FILES holds package-relative paths (typst.toml, typst/ink.typ, and the tables/ the Typst sources read)
with their bytes; spec() is the import specification.
use cink::typst::{FILES, NAME, NAMESPACE, VERSION, spec};
assert_eq!((NAMESPACE, NAME), ("preview", "cink"));
assert_eq!(spec(), format!("@preview/cink:{VERSION}"));
for (path, bytes) in FILES {
// Serve `bytes` for `path` inside the package `spec()` in your Typst world.
let _ = (path, bytes.len());
}
Documents then import the package as usual, for example
#import "@preview/cink:0.2.2": signature-image.
Python
from cink import image_snippet
assert image_snippet("/signature.png", 31.5) == '#image("/signature.png", height: 31.5pt)'
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.2 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.2 is published to registries.
See the licensing notes for distribution conditions and retained notices. Contributions use the Contributor License Agreement.
Metadata
Release files for cink 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cink-0.2.2.tar.gz | 38.8 kB | Without provenance | Details for cink-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cink-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for cink-0.2.2-py3-none-any.whl |
Total release size: 76.6 kB
Release files / cink-0.2.2.tar.gz
| Download URL | cink-0.2.2.tar.gz |
|---|---|
| Size | 38.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93d03796ecf898249961606c9dc5de2be83878dab497a756ed6fc6c3724fa065
|
|
BLAKE2b-256 checksum How to use checksums |
c4dfca17f58976bf11c4aaa43faa39ac2e03299f2241fffb385a6b5a7c4d5cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cink-0.2.2-py3-none-any.whl
| Download URL | cink-0.2.2-py3-none-any.whl |
|---|---|
| Size | 37.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96530b29b1c352c9fefc85512abf62d4baa6347a351b5ba8b5aa302512a24771
|
|
BLAKE2b-256 checksum How to use checksums |
c0ea3245eb7f694ad3cb91977b3460aa6dd9d735858854374028c1784a466575
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for cink 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.