Skip to main content

cink

Prepare handwritten signature images for correspondence.

crates.io npm PyPI Rust API

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)");

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.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.

Release files for cink 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cink 0.2.1
File Size Uploaded
cink-0.2.1.tar.gz 38.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cink 0.2.1
File Interpreter ABI Platform
cink-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 75.5 kB

Release files / cink-0.2.1.tar.gz

Download URL cink-0.2.1.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e6901908bcd49972cc8273a47fe82d75b23e3fe4a63c4c4653a3380d66a675c9
BLAKE2b-256 checksum
How to use checksums
3dd296d906c5ff4d69cf84668bd72c7c722b8b0c2cae1bb695e684a71fc338db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via ccid-registry-publisher/1; https://github.com/corbet-labs/ccid

Release files / cink-0.2.1-py3-none-any.whl

Download URL cink-0.2.1-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
058e861ab66c0c1eb194c78f80d80e06a6540d27827239ca9b5afcabc4a12e7a
BLAKE2b-256 checksum
How to use checksums
0a7ef6034b2f2b89743bdfe696dd5438002b689f3545fe421943a59eddf0a395
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via ccid-registry-publisher/1; https://github.com/corbet-labs/ccid

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page