How this tool works

Written out in full, because a site that asks you to believe a photo of your face never leaves your device owes you the detail to check that.

Nothing is uploaded

There is no server in this product. The page is static HTML, and the tool is JavaScript and WebAssembly that runs in your tab. Your photo is decoded into a canvas, measured, cropped and encoded again, all in memory on your own machine.

You do not have to take that on trust. Open your browser's developer tools, switch to the Network panel, and make a photo: you will see the models load once and then nothing at all. Or simpler — load this page, disconnect from the internet, and make a photo anyway. It still works.

The two models

The tool loads two models from this site, both from Google's MediaPipe project and both under the Apache 2.0 licence. The first is a face landmarker that returns 478 points, including the irises. The second is a selfie segmenter that separates the person from the background.

They are downloaded once, cached by the browser, and run locally. Together they are about 16 MB, which is why the tool loads them when you open a photo rather than when you open the page.

Why segmentation, and not just landmarks

Passport rules measure your head from the bottom of your chin to the crown — the top of your head, hair included. Face-mesh models do not give you that point. Their topmost landmark sits on the forehead, and the distance from there to the top of a person's hair depends on the hair.

So tools built on landmarks alone have to estimate the crown, and the estimate is where head height errors come from. This tool instead scans down the segmentation mask inside a narrow band centred on your face and takes the first row that is confidently "person". That is the top of your hair. When the scan fails — an unusual hairstyle, a background close to your hair colour — the tool falls back to the estimate and tells you it has, so you can drag the marker yourself.

How the crop is solved

Two constraints, two free variables, and no iteration. The head height you need fixes the scale: if the authority wants 30 mm of head and your photo has 1,200 pixels of head, the output scale follows directly. The eye line — or, where an authority does not state one, a crown margin — fixes the vertical position. Both are satisfied exactly rather than approximately.

What can fail is fit: the resulting rectangle may not lie inside your photo. The tool first tries growing the head within the range the authority permits, which shrinks the rectangle. Only if that fails does it extend the frame, and it says so when it does.

The DPI that most tools drop

A canvas exports a JPEG whose header declares no unit and a 1:1 aspect ratio, and a PNG with no physical size at all. Print software then guesses, and it usually guesses 72 DPI — which is how a 2 × 2 inch passport photo arrives at a print counter as a 16 inch poster.

This tool rewrites the JFIF density fields in the JPEG and inserts a pHYs chunk into the PNG, so the file states its real resolution. It is a handful of bytes and it is the difference between a print that measures correctly and one that does not.

What is measured, and how

Sharpness is the variance of the Laplacian over the face region only, computed on a render at a fixed height so the number means the same thing for a 3-megapixel photo and a 48-megapixel one. Exposure is mean luminance across the face; even lighting is the difference between its left and right halves. Background uniformity is the standard deviation of luminance in strips down each side, outside the head. Head tilt comes from the angle between the two irises.

Those are honest, simple measures with thresholds we can defend, and they are reported as numbers rather than as a pass badge, because a photo that is marginal should look marginal.

What it deliberately does not do

  • It does not judge glasses glare or red-eye. Both are hard to measure reliably and a wrong answer is worse than no answer.
  • It does not retouch faces. Not skin, not eyes, not shape. Several authorities reject photos that have been, and there is no version of this feature that is safe to ship quietly.
  • It does not promise acceptance. It measures against published rules. The office you apply to decides, and some of them run their own automated checks.

Licences

MediaPipe Tasks Vision and both models are © Google LLC under the Apache License 2.0. The full list of what is bundled is in licenses/README.md.