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 locale tables 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.0 release line is licensed under LGPL-3.0-only [WITH LGPL-3.0-linking-exception](https://github.com/corbet-labs/cink/blob/main/LICENSES/LGPL-3.0-only%20WITH%20LGPL-3.0-only WITH LGPL-3.0-linking-exception.txt), 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. Previously released and already prepared distributions retain their original grants. The installation examples above refer to those available releases; 0.2.0 has not yet been published to registries.

See the licensing notes for distribution conditions and retained notices.

Release files for cink 0.2.0

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.0
File Size Uploaded
cink-0.2.0.tar.gz 38.2 kB Details

Built distribution (wheel)

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

Total release size: 76.5 kB

Release files / cink-0.2.0.tar.gz

Download URL cink-0.2.0.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f48cb8a30f89bc8362acda3d4689c4c61fa2d51caf257b1dc6a591ac407d4224
BLAKE2b-256 checksum
How to use checksums
6a084d8beb89ab0aaa7efbbbf0534a977dc6e03a05e16bdae1bd79458181fd9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"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.0-py3-none-any.whl

Download URL cink-0.2.0-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20f6103223f3c05e9355b260836d1263ba6b646d8c8b433019570b210e6e0e6b
BLAKE2b-256 checksum
How to use checksums
9634751e57f3356540671edb3e207dba71dd76f93e93f8239d842dbca5fc847c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

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