Prepare signature image
prepare_signatureTurns a scanned signature into a clean transparent PNG by cropping white borders and removing the background, optionally recolouring the ink for use in print-ready PDF letters.
Instructions
Cleans up a scanned signature: crops white borders, turns the paper background transparent and optionally recolours the ink. Writes a PNG that can be passed to create_letter as signature.path. Needs the optional sharp dependency.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to the scan (PNG, JPEG, and with sharp also WebP/TIFF/HEIC). | |
| trim | No | Crop uniform borders, default true. | |
| base64 | No | Image data as base64 or data URL, alternative to path. | |
| inkColor | No | Recolour the ink, e.g. "#1a1a1a". | |
| overwrite | No | ||
| outputPath | No | Target PNG path. Default: output directory plus "signature.png". | |
| removeBackground | No | Turn the white background transparent, default true. | |
| backgroundThreshold | No | Luminance cutoff, default 0.85. |