Why a ready-made ID photo failed our browser framing check
Treat head centring as a preference: clamp the crop to valid bounds, then test against the rotated image. That fixed our framing bug. A −1.1° rotation left roughly 10 px of blank space at the top corners of a 538 px-wide crop. You can check your own photo against these rules for free in your browser on this page ; the photo is never uploaded (disclosure: I built it). Why did ready-made ID photos…
A bug in the browser's photo framing check was causing ready-made ID photos to fail, even though the head was properly centered. To fix this, the code was modified to clamp the crop to valid bounds and test against the rotated image. This allowed the cropped image to be checked for actual content coverage, rather than just its position within the canvas.
The issue was caused by treating vertical centring as mandatory and treating the canvas boundary as the image boundary. Adjusting the code to consider the image content itself resolved the problem, allowing photos with blank corners to pass the test.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.