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
RuleLimit
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
filesat 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
layoutflat: no subfolders, no symbolic links
imagesPNG only, checked by signature, chunk CRCs and a full decode, not by extension
each imageat most 2048 × 2048 px
each fileat most 2 MiB (2,097,152 bytes)
whole packageat most 6 MiB (6,291,456 bytes)
lens.jsonat most 64 KiB, UTF-8 without a byte-order mark
thumbnail.pngexactly 256 × 256
referencesevery 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.

KeyTypeRequiredMeaning
idstringyesThe package id. Must match the folder name.
namestringyesDisplay name: 1–40 characters, no control characters, no leading or trailing space.
authorstringno1–60 characters.
formatVersionintegeryes1 for this format. The app refuses a lens newer than it knows.
orderintegernoPosition in a list, lowest first (−1,000,000 to 1,000,000).
thumbnailstringnoIf present, exactly "thumbnail.png". The file is required either way, but the picker only shows it when the manifest names it, so name it.
gradeobjectnoA colour treatment under the layers (see below).
layersarrayyes0–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.

KeyTypeDefaultRangeMeaning
assetstringrequireda PNG in the packageThe image.
idstringthe asset name^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$, unique in the lensNames the layer. The same image can be drawn by several layers, so ids must differ.
anchorstringrequiredsee belowWhat the layer hangs from.
scalenumber1above 0, at most 12 (screen: 4)Width in interocular distances. On screen: a fraction of the frame's width. Height follows the image.
offsetpoint0, 0each 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].
rotationnumber0−360 to 360Degrees, clockwise on screen, on top of the head's roll.
opacitynumber10 to 1Multiplies the image's alpha.
blendstringnormalnormal, screen, multiply, addHow the layer combines with what's under it.
zinteger0−1000 to 1000Draw order, lowest first.
mirrorsWithCamerabooleantrueFlip 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.

AnchorThe pointTypical position (IOD from between the eyes, y down)
eyeCentremidpoint of the two eyes(0, 0)
leftEye / rightEyethe eye on the image's left or right(∓0.5, 0)
noseTipcentre of the nose(0, 0.7)
mouthcentre of the lips(0, 1.1)
chinlowest point of the jaw(0, 1.8)
foreheada fixed 0.95 IOD above the eye line(0, −0.95)
faceCentremiddle of the face's boxabout (0, 0.55)
screenignores the face: the frame's centre plus the offset, width scale × the framenone

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.

KeyDefaultRangeWhat it does
saturation10 to 3Colour intensity.
contrast10.25 to 4Contrast.
warmth0−2 to 2Colour temperature; positive is warmer.
vignette00 to 2Darkened corners.
lutnonenot allowedA lens can't carry a lookup table. Use a filter.

Blending

blendUse it forTransparent means
normalobjects: hats, glasses, stickersnothing drawn
multiplytints that darken: blush, frecklesno change (white too)
screenlight that brightens: glows, bokehno change (black too)
addhot light, neon coresno 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.

CodeMeaning
manifest_missing, manifest_invalid_json, manifest_not_objectlens.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_rangea 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_versionthe id doesn't match the pattern; formatVersion isn't one the gateway knows
unsupported_fieldgrade.lut
duplicate_layer_id, too_many_layerstwo layers share an id; more than 16 layers
asset_missing, unreferenced_filea named image is missing; a file nothing names
bad_file_name, subfolder, bad_filea name, a folder, a link or a special file
too_many_files, file_too_large, package_too_largethe package limits
png_invalid, image_too_largenot a complete, valid PNG; over 2048 px on a side
thumbnail_missing, thumbnail_sizethumbnail.png missing or not 256 × 256
id_mismatchlocal 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