Lens format: layers, anchors and blends
A lens is a manifest naming anchors, images and numbers. Format 1 is the foundation every later format builds on, and every format 1 lens stays valid.
The package
A lens is a flat folder named <id>.fentralens/:
puppy.fentralens/
lens.json the manifest
thumbnail.png 256 × 256 picker image (required)
puppy_ears.png layer images, named from lens.json
puppy_nose.png
puppy_blush.png| Rule | Limit |
|---|---|
id (in lens.json, and the folder name before .fentralens) | ^[a-z0-9][a-z0-9-]{2,40}$: lower case, digits and hyphens, no dots |
| files | at most 16, counting lens.json and thumbnail.png |
| file names | ^[a-z0-9][a-z0-9_-]{0,63}\.(png|json)$: lower case, no spaces, no hidden files |
| layout | flat: no subfolders, no symbolic links |
| images | PNG only, checked by signature, chunk CRCs and a full decode, not by extension |
| each image | at most 2048 × 2048 px |
| each file | at most 2 MiB (2,097,152 bytes) |
| whole package | at most 6 MiB (6,291,456 bytes) |
lens.json | at most 64 KiB, UTF-8 without a byte-order mark |
thumbnail.png | exactly 256 × 256 |
| references | every file a layer names must be there, and every other file must be named by a layer |
So lens.json is the only JSON file in a lens. System litter (.DS_Store, ._*, Thumbs.db, desktop.ini) is never part of a package: the tools skip it. A lens cannot carry a .cube colour table; publish a look as a filter instead.
lens.json
A JSON object, parsed strictly: no NaN or Infinity, no duplicate keys, no numbers that overflow. Unknown keys are errors, at every level.
| Key | Type | Required | Meaning |
|---|---|---|---|
id | string | yes | The package id. Must match the folder name. |
name | string | yes | Display name: 1–40 characters, no control characters, no leading or trailing space. |
author | string | no | 1–60 characters. |
formatVersion | integer | yes | 1 for this format. The app refuses a lens newer than it knows. |
order | integer | no | Position in a list, lowest first (−1,000,000 to 1,000,000). |
thumbnail | string | no | If present, exactly "thumbnail.png". The file is required either way, but the picker only shows it when the manifest names it, so name it. |
grade | object | no | A colour treatment under the layers (see below). |
layers | array | yes | 0–16 layers. A lens with no layers must have a grade. |
Here is a real one, neon-horns from the seed library: a glow drawn with screen under the horns themselves, and a cool, vignetted grade.
{
"id": "neon-horns",
"name": "Neon Horns",
"author": "Fentra",
"formatVersion": 1,
"order": 510,
"thumbnail": "thumbnail.png",
"grade": { "saturation": 1.1, "contrast": 1.06, "warmth": -0.25, "vignette": 0.7 },
"layers": [
{ "id": "glow", "asset": "neon_glow.png", "anchor": "forehead", "scale": 3.8,
"offset": { "x": 0.0, "y": -1.175 }, "blend": "screen", "z": 9 },
{ "id": "tubes", "asset": "neon_horns.png", "anchor": "forehead", "scale": 3.2406,
"offset": { "x": 0.0, "y": -1.175 }, "z": 10 }
]
}Versions
formatVersion is the version of the format. A lens's content version is not in lens.json. The gateway assigns it when a submission is approved: the first approved submission of an id is version 1, and each later approved submission of the same id is the next number. A submission does not send it.
Layers
Each layer draws one image, attached to the face.
| Key | Type | Default | Range | Meaning |
|---|---|---|---|---|
asset | string | required | a PNG in the package | The image. |
id | string | the asset name | ^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$, unique in the lens | Names the layer. The same image can be drawn by several layers, so ids must differ. |
anchor | string | required | see below | What the layer hangs from. |
scale | number | 1 | above 0, at most 12 (screen: 4) | Width in interocular distances. On screen: a fraction of the frame's width. Height follows the image. |
offset | point | 0, 0 | each at most 12 (screen: 2) | Where the image's centre sits from the anchor: x along the eye line toward the image's right eye, y down the face. {"x": 0, "y": -0.06} or [0, -0.06]. |
rotation | number | 0 | −360 to 360 | Degrees, clockwise on screen, on top of the head's roll. |
opacity | number | 1 | 0 to 1 | Multiplies the image's alpha. |
blend | string | normal | normal, screen, multiply, add | How the layer combines with what's under it. |
z | integer | 0 | −1000 to 1000 | Draw order, lowest first. |
mirrorsWithCamera | boolean | true | Flip with the front camera. |
Numbers are JSON numbers: an integer field accepts 1 or 1.0, not "1" or true.
Anchors and face space
The unit is the face's interocular distance (IOD): pupil to pupil, about 63 mm on an adult. A layer's centre is the anchor plus offset × IOD, with the offset turned by the head's roll, so something above the eyes stays above them when the head tilts. Its width is scale × IOD.
| Anchor | The point | Typical position (IOD from between the eyes, y down) |
|---|---|---|
eyeCentre | midpoint of the two eyes | (0, 0) |
leftEye / rightEye | the eye on the image's left or right | (∓0.5, 0) |
noseTip | centre of the nose | (0, 0.7) |
mouth | centre of the lips | (0, 1.1) |
chin | lowest point of the jaw | (0, 1.8) |
forehead | a fixed 0.95 IOD above the eye line | (0, −0.95) |
faceCentre | middle of the face's box | about (0, 0.55) |
screen | ignores the face: the frame's centre plus the offset, width scale × the frame | none |
Face layers are drawn once for every usable face and skipped when there is none. Screen layers are always drawn.
Proportions worth designing to: outer eye corners ±0.73, brows −0.38, hairline about −1.1, the crown of the head about −1.95 (−2.05 with hair), ears at x ±1.15 to 1.38. Between 300 and 420 px per IOD is plenty for images. Use straight (not premultiplied) alpha in sRGB. A full-frame screen overlay is 9:16 at scale 1, for example 1080 × 1920; on other frame shapes it is cropped top and bottom.
Grade
An optional colour treatment, applied to the frame under the layers.
| Key | Default | Range | What it does |
|---|---|---|---|
saturation | 1 | 0 to 3 | Colour intensity. |
contrast | 1 | 0.25 to 4 | Contrast. |
warmth | 0 | −2 to 2 | Colour temperature; positive is warmer. |
vignette | 0 | 0 to 2 | Darkened corners. |
lut | none | not allowed | A lens can't carry a lookup table. Use a filter. |
Blending
blend | Use it for | Transparent means |
|---|---|---|
normal | objects: hats, glasses, stickers | nothing drawn |
multiply | tints that darken: blush, freckles | no change (white too) |
screen | light that brightens: glows, bokeh | no change (black too) |
add | hot light, neon cores | no change |
A normal layer whose PNG has no alpha channel draws an opaque rectangle; the validator warns about it.
Mirroring
With the front camera the picture is a mirror image. A layer with mirrorsWithCamera: true is drawn flipped, so it stays on the same side of the person. Set it to false for anything that must read the right way round, such as lettering, and for a left and right pair on leftEye and rightEye with a tilt: those anchors are already the image's sides, so a mirrored pair's outward tilts would turn inward. heart-eyes in the seed library does exactly this.
Validation
The gateway checks a submission against everything above and answers with pending or invalid, and a list of {code, path, message} errors. validate.py reports the same way.
| Code | Meaning |
|---|---|
manifest_missing, manifest_invalid_json, manifest_not_object | lens.json is missing, unreadable (including a byte-order mark, NaN or duplicate keys) or not an object |
missing_field, unknown_field, invalid_type, invalid_value, out_of_range | a key is missing, unknown, the wrong type, not allowed or out of range; path names it, for example lens.json.layers[2].opacity |
invalid_id, unsupported_format_version | the id doesn't match the pattern; formatVersion isn't one the gateway knows |
unsupported_field | grade.lut |
duplicate_layer_id, too_many_layers | two layers share an id; more than 16 layers |
asset_missing, unreferenced_file | a named image is missing; a file nothing names |
bad_file_name, subfolder, bad_file | a name, a folder, a link or a special file |
too_many_files, file_too_large, package_too_large | the package limits |
png_invalid, image_too_large | not a complete, valid PNG; over 2048 px on a side |
thumbnail_missing, thumbnail_size | thumbnail.png missing or not 256 × 256 |
id_mismatch | local only: the manifest's id isn't the folder's name |
Warnings never stop a submission at the gateway; locally, --strict makes them fatal: thumbnail_not_named, thumbnail_as_asset, asset_opaque, png_animated (only the first frame is drawn) and png_16bit.
Next: Lens format 2 puts every layer on a 3D head.
Checked against the specs on 4 November 2026.
NextLens format 2: the 3D head