<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wayne John</title>
    <description>The latest articles on DEV Community by Wayne John (@wayne_john_9c7a5ab849655c).</description>
    <link>https://dev.to/wayne_john_9c7a5ab849655c</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1932152%2F0ade17c6-2dad-45e7-b70e-1802e13fc431.jpg</url>
      <title>DEV Community: Wayne John</title>
      <link>https://dev.to/wayne_john_9c7a5ab849655c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wayne_john_9c7a5ab849655c"/>
    <language>en</language>
    <item>
      <title>How We Built an In-Browser Passport Photo Checker with Next.js 16 &amp; MediaPipe</title>
      <dc:creator>Wayne John</dc:creator>
      <pubDate>Thu, 12 Nov 2026 03:46:33 +0000</pubDate>
      <link>https://dev.to/wayne_john_9c7a5ab849655c/how-we-built-an-in-browser-passport-photo-checker-with-nextjs-16-mediapipe-20dc</link>
      <guid>https://dev.to/wayne_john_9c7a5ab849655c/how-we-built-an-in-browser-passport-photo-checker-with-nextjs-16-mediapipe-20dc</guid>
      <description>&lt;p&gt;Getting a passport photo in the US often feels unnecessarily frustrating. Retail pharmacies like CVS and Walgreens charge upwards of $17.99 for two small 2x2" prints, and worse, applicants frequently report rejections due to subtle biometric violations—incorrect head height ratio (must be between 50% and 69% of image height), harsh shadows, or slight head tilts.&lt;/p&gt;

&lt;p&gt;To solve this friction, we built &lt;a href="https://idphoto.studio" rel="noopener noreferrer"&gt;IdPhoto Studio&lt;/a&gt;, a privacy-first web utility that verifies and generates compliant passport photos directly within the browser.&lt;/p&gt;

&lt;p&gt;In this post, I want to share the technical challenges and architecture behind building a client-side biometric compliance checker.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why Run Biometric Checks in the Browser?
&lt;/h2&gt;

&lt;p&gt;Most passport photo apps upload user photos to an external cloud server for face analysis. However, government documents and passport photos contain sensitive biometric face data. &lt;/p&gt;

&lt;p&gt;We chose an &lt;strong&gt;edge-first and client-side approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Face landmark detection runs entirely in the client using WebAssembly via &lt;code&gt;@mediapipe/tasks-vision&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The user's original image never leaves their device during the verification phase.&lt;/li&gt;
&lt;li&gt;Only when an applicant confirms the alignment do they have the option to generate official print sheets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can try the free online tool here: &lt;a href="https://idphoto.studio/passport-photo-checker" rel="noopener noreferrer"&gt;Passport Photo Checker&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Implementing the Biometric Geometry (ICAO &amp;amp; US State Dept)
&lt;/h2&gt;

&lt;p&gt;The US Department of State Form DS-11 specifies strict geometric rules for 2x2 inch photos:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Head Size&lt;/strong&gt;: The distance from the bottom of the chin to the top of the head must be between 1 inch and 1 3/8 inches (50% to 69% of the total image height).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eye Height&lt;/strong&gt;: The eyes must sit between 1 1/8 inches and 1 3/8 inches from the bottom of the photo (56% to 69%).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face Angle &amp;amp; Tilt&lt;/strong&gt;: Yaw and roll angles must stay within strict thresholds (no side profile, no tilting).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using MediaPipe's Face Mesh landmarks, we calculate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Landmark 152 (Chin bottom) and Landmark 10 (Forehead top) to determine the vertical head scale.&lt;/li&gt;
&lt;li&gt;Landmarks 33 and 263 (Outer eye corners) to detect roll angle tilt and automatically suggest micro-rotations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. The Print Sheet Problem (Save $17.60 with 4x6" Layouts)
&lt;/h2&gt;

&lt;p&gt;One of our favorite features is the print sheet layout generator. While CVS and Walgreens charge $17.99 if you order "Passport Photos", they only charge around $0.38 to print a standard 4x6" gloss photo.&lt;/p&gt;

&lt;p&gt;We implemented an SVG-to-Canvas layout engine that automatically arranges multiple 2x2" copies onto a standard 1200x1800 px (4x6" at 300 DPI) sheet with exact cutting guidelines. This allows travelers to print their photos at local kiosks for less than 40 cents.&lt;/p&gt;

&lt;p&gt;Check out our full cost breakdown and guide: &lt;a href="https://idphoto.studio/cvs-vs-walgreens-passport-photo-cost" rel="noopener noreferrer"&gt;CVS vs Walgreens Passport Photo Cost Comparison&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Framework&lt;/strong&gt;: Next.js 16 (App Router + Turbopack)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling&lt;/strong&gt;: Tailwind CSS v4&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Computer Vision&lt;/strong&gt;: &lt;code&gt;@mediapipe/tasks-vision&lt;/code&gt; (WebAssembly)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt;: Vercel Edge Network&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We hope this provides an interesting look into implementing client-side biometric verification! Feedback and questions are always welcome in the comments.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>nextjs</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
