API¶
The import binds the module lookscanned. Every function below is called through it, for example lookscanned.scan.
| Name | Kind | Purpose |
|---|---|---|
scan |
show rule | Apply the effect to the whole document |
page |
function | Override page-level settings for some pages |
region |
function | Apply text effects to one block |
stamp |
function | Rubber stamp |
scribble |
function | Approximate handwriting or scrawl |
stain |
function | One stain |
texture |
function | A raw texture image |
presets |
dictionary | Built-in presets |
Names starting with _ are internal and may change without notice.
Common arguments¶
scan, page and region take the same named arguments:
| Argument | Type | Default | Description |
|---|---|---|---|
preset |
str or dictionary |
"office-scan" |
Name of a built-in preset, or a dictionary of themes merged on neutral values. |
intensity |
int or float ≥ 0 |
1 |
Multiplier applied to the preset and themes. See intensity. |
seed |
int |
0 |
Selects the random variant. Same seed, same result. |
paper, stains, ink, skew, edges, scanner, quality |
dictionary |
from the preset | Theme overrides. See Themes. |
For page, unset arguments are inherited from scan instead of these defaults.
Positional arguments other than the body, unknown themes, unknown keys and values of the wrong type stop compilation with an error that names the problem.
scan¶
Applies the effects to everything that follows. It:
- sets the page
background(paper, grain, stains) andforeground(scanner lines and bands, dust, lighting, punch holes), replacing any you set before; - rotates and moves paragraphs, headings, lists, enumerations, term lists, figures, block equations and code blocks so that each page looks rotated;
- applies ink effects, and word or character jitter, to every text run;
- applies ink effects to every equation as a whole (see Mathematics).
Place it after your set page rules, and before a template rule that must come last.
page¶
Overrides the page-level effects for every page that body spans: paper, stains, dust, lighting, scanner artefacts and page rotation. Ink and text jitter stay those of scan. It inserts no page break. It cannot be nested. Requires scan.
region¶
Returns a full-width block filled with the paper colour and grain, slightly rotated, whose text and equations get the ink and jitter effects. It needs no scan. Avoid it inside a scan document: text effects would apply twice.
stamp¶
| Argument | Type | Default | Description |
|---|---|---|---|
body |
content or str |
required | Text of the stamp, set in bold capitals. |
color |
color |
rgb("#c0392b") |
Ink colour. |
angle |
angle |
-12deg |
Rotation. |
size |
length |
16pt |
Text size. |
seed |
int |
0 |
Ink pattern. |
at |
dictionary or none |
none |
(x: .., y: ..) position of the top-left corner, relative to the container. none inserts it inline. |
scribble¶
| Argument | Type | Default | Description |
|---|---|---|---|
body |
str or none |
none |
Text written in a wobbly italic. With none, a scrawl is drawn instead. |
color |
color |
blue |
Ink colour. |
width |
length |
4cm |
Width of the scrawl (ignored with a body). |
seed |
int |
0 |
Shape variant. |
angle |
angle |
-3deg |
Rotation. |
at |
dictionary or none |
none |
(x: .., y: ..) position of the top-left corner. |
stain¶
| Argument | Type | Default | Description |
|---|---|---|---|
at |
dictionary or none |
none |
(x: .., y: ..) position of the centre. none inserts it inline. |
color |
color |
rgb("#6b4423") |
Stain colour. |
size |
length |
20mm |
Diameter. |
seed |
int |
0 |
Shape variant: blotch, ring or splatter. |
texture¶
| Argument | Type | Default | Description |
|---|---|---|---|
kind |
str |
required | One of the texture kinds. |
seed |
int |
0 |
Variant. |
width, height |
length or auto |
auto |
Size of the image. auto uses the page size and requires a fixed page height. |
resolution |
number | 150 |
DPI. Some kinds use a fraction of it. |
..parameters |
named | Kind-specific parameters. Lengths are converted to pixels. |
Returns an image.
presets¶
A dictionary mapping each preset name to its themes. Presets only list the keys that differ from the neutral values. See Presets.