<?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: Ashish Sikka</title>
    <description>The latest articles on DEV Community by Ashish Sikka (@ashish_sikka).</description>
    <link>https://dev.to/ashish_sikka</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%2F4229590%2F166b273a-c32e-401a-923d-7056c7799342.jpg</url>
      <title>DEV Community: Ashish Sikka</title>
      <link>https://dev.to/ashish_sikka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashish_sikka"/>
    <language>en</language>
    <item>
      <title>How to sell photos online and earn money in India (2026 guide)</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Mon, 16 Nov 2026 19:00:00 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/how-to-sell-photos-online-and-earn-money-in-india-2026-guide-3p0f</link>
      <guid>https://dev.to/ashish_sikka/how-to-sell-photos-online-and-earn-money-in-india-2026-guide-3p0f</guid>
      <description>&lt;p&gt;&lt;em&gt;I work on sellphotos.online, where this was &lt;a href="https://sellphotos.online/blog/sell-photos-online-india" rel="noopener noreferrer"&gt;originally published&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can earn money selling photos online from India. How much depends on one question that most&lt;br&gt;
guides skip: &lt;strong&gt;who is the buyer?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are three kinds of buyer, and each needs a different website, a different kind of photo and&lt;br&gt;
a different amount of patience.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Way&lt;/th&gt;
&lt;th&gt;Who buys&lt;/th&gt;
&lt;th&gt;Earnings per sale&lt;/th&gt;
&lt;th&gt;How soon&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Stock sites&lt;/td&gt;
&lt;td&gt;Companies and designers you never meet&lt;/td&gt;
&lt;td&gt;Small: often under a dollar&lt;/td&gt;
&lt;td&gt;Slow. Months to years&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Event photos&lt;/td&gt;
&lt;td&gt;The people in the photo&lt;/td&gt;
&lt;td&gt;Larger: you set the price in rupees&lt;/td&gt;
&lt;td&gt;Fast. The same week&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Your own store&lt;/td&gt;
&lt;td&gt;Your followers and local businesses&lt;/td&gt;
&lt;td&gt;You set it&lt;/td&gt;
&lt;td&gt;Depends on your audience&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This guide walks through all three, with real rates checked on 12 November 2026. We build&lt;br&gt;
&lt;a href="https://sellphotos.online/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt;,&lt;br&gt;
which is a tool for way 2, so you know where we stand. The guide tells you when ways 1 and 3 fit&lt;br&gt;
you better.&lt;/p&gt;

&lt;h2&gt;
  
  
  Way 1: Sell to strangers on stock photo sites
&lt;/h2&gt;

&lt;p&gt;You upload photos to a site such as Shutterstock or Adobe Stock. A company somewhere needs a photo&lt;br&gt;
of a Mumbai local train for a presentation, searches, finds yours and licenses it. You get a share.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it pays
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shutterstock&lt;/strong&gt; pays 15% to 40% of each licence, depending on how many you sell in the year.
Everyone starts at 15%. The minimum is $0.10 per download.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adobe Stock&lt;/strong&gt; pays a flat 33% on photos, with a minimum of $0.33 per licence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alamy&lt;/strong&gt; starts new contributors at 20% (changed on 1 September 2026).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Getty Images / iStock&lt;/strong&gt; pays non-exclusive contributors 15% on photos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What does that come to? One contributor who publishes his numbers on the blog Brutally Honest&lt;br&gt;
Microstock reported average earnings per download for 2025 of about $0.51 on Shutterstock and&lt;br&gt;
$0.74 on Adobe Stock. That is one person's portfolio, not a promise. It shows the shape of stock&lt;br&gt;
income: small amounts, many times, over years.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to start
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick subjects buyers search for.&lt;/strong&gt; Indian daily life, festivals, food, offices, farming,
small shops, students. Not sunsets and flowers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the file.&lt;/strong&gt; At least 4 megapixels, JPEG, sharp at full size. Phone photos are accepted
if they meet this; see &lt;a href="https://sellphotos.online/blog/sell-phone-photos-online-india?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;selling phone photos&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get permission.&lt;/strong&gt; A recognisable person needs a signed model release for commercial use.
Private buildings, logos and artwork need one too.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write clear titles and keywords.&lt;/strong&gt; "Woman selling vegetables at a street market in Jaipur,
India" gets found. "IMG_4521" does not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upload to two sites, and keep uploading.&lt;/strong&gt; The same photo can be on several sites unless you
sign an exclusive deal.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How the money reaches India
&lt;/h3&gt;

&lt;p&gt;The big stock sites pay in US dollars through &lt;strong&gt;PayPal or Payoneer&lt;/strong&gt;, usually once you cross $25&lt;br&gt;
(Shutterstock, Adobe Stock). None of the large ones we checked pays into an Indian bank account&lt;br&gt;
directly, except Alamy, which offers bank transfer above $75.&lt;/p&gt;

&lt;p&gt;Before the first payout they ask you to fill in a US tax form called &lt;strong&gt;W-8BEN&lt;/strong&gt;. Without it,&lt;br&gt;
Shutterstock and Adobe Stock withhold 30% of your US sales. With it, India's tax treaty with the&lt;br&gt;
US brings the rate on royalties down, usually to 15%. The form is free and takes a few minutes&lt;br&gt;
inside your contributor account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stock suits you if&lt;/strong&gt; you enjoy shooting useful, generic subjects and can keep going for a year&lt;br&gt;
before judging the result. Site-by-site details are in&lt;br&gt;
&lt;a href="https://sellphotos.online/blog/best-websites-to-sell-photos-online-india?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;the 12 best websites to sell photos online in India&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Way 2: Sell event photos to the people in them
&lt;/h2&gt;

&lt;p&gt;This is the one most guides leave out, and for many Indian photographers it pays the fastest.&lt;/p&gt;

&lt;p&gt;Think about a school annual day. 400 children on stage, 800 parents in the hall, and every parent&lt;br&gt;
wants a good photo of their own child. A stock site can't sell that photo to anyone. The parent&lt;br&gt;
will buy it tonight.&lt;/p&gt;

&lt;p&gt;The same is true of garba nights, convocations, college fests, marathons, cricket tournaments and&lt;br&gt;
society functions. The buyers are already at the event.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Upload the shoot&lt;/strong&gt; and set your prices in rupees: per photo, "all my photos", or the whole
event.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share one link or QR code.&lt;/strong&gt; Print it at the venue and post it in the WhatsApp group.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guests find themselves with a selfie.&lt;/strong&gt; No app, no sign-up to browse. Face search shows them
only the photos they are in, as watermarked previews.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;They pay you by UPI.&lt;/strong&gt; The money goes straight to your UPI ID or bank account. They upload
the payment screenshot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You approve, they download.&lt;/strong&gt; Check the money arrived, approve the order, and the full-size
originals unlock.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0i3t70cart7f550jo4t3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0i3t70cart7f550jo4t3.png" alt="Five steps: upload, share the QR code, selfie, pay the seller, download the originals" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What it pays
&lt;/h3&gt;

&lt;p&gt;You set the price, and you keep all of it, because the buyer pays you directly.&lt;/p&gt;

&lt;p&gt;Here is an example with made-up but reasonable numbers. 800 people attend. One in ten buys "all my&lt;br&gt;
photos" at ₹299. That is 80 orders and ₹23,920 from one evening. Change the three numbers to match&lt;br&gt;
your event and redo the sum.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it costs
&lt;/h3&gt;

&lt;p&gt;On sellphotos.online there is no commission. You pay a yearly plan from $99 for 20,000 photos and&lt;br&gt;
250 approved orders. It is billed in US dollars and the checkout shows the rupee amount. There is&lt;br&gt;
no free plan. You also approve every paid order by hand, which is the trade-off for nobody holding&lt;br&gt;
your money.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event photos suit you if&lt;/strong&gt; you already shoot events, or can get into one: your college fest,&lt;br&gt;
your child's school, your housing society. Read the full method in&lt;br&gt;
&lt;a href="https://sellphotos.online/blog/sell-event-photos-india-upi?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;how to sell event photos in India and get paid by UPI&lt;/a&gt;,&lt;br&gt;
or try the &lt;a href="https://sellphotos.online/demo?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;sample gallery&lt;/a&gt;&lt;br&gt;
as a guest would.&lt;/p&gt;

&lt;h2&gt;
  
  
  Way 3: Sell from your own store
&lt;/h2&gt;

&lt;p&gt;If people already follow your work, you can sell to them without a stock site in the middle.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Digital files and presets.&lt;/strong&gt; Indian tools such as Instamojo let you sell a file and take
payment by UPI or card. Its free plan charges 10% + ₹3 on a digital sale, and a plain payment
link costs 2% + ₹3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prints.&lt;/strong&gt; Landscape, wildlife and heritage photos sell as framed prints to homes, cafés and
offices. Your margin is the sale price minus printing, framing and delivery.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Buyers abroad.&lt;/strong&gt; Etsy lets Indian shops sell to international buyers only, asks for a GSTIN
and pays out in dollars through Payoneer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local businesses.&lt;/strong&gt; Shops, restaurants and online sellers pay for product and menu photos.
This is a service more than a store, and it is often the quickest first income.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Your own store suits you if&lt;/strong&gt; you have an audience, or are willing to build one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which way should you choose?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You have a camera, free weekends and events around you:&lt;/strong&gt; way 2 first. It pays this month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You travel and have thousands of photos on a hard disk:&lt;/strong&gt; way 1. Start uploading and let it
build.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You have 5,000 followers who like your style:&lt;/strong&gt; way 3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You have only a phone:&lt;/strong&gt; ways 2 and 3 for small events and local shops, and way 1 for
daylight photos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They mix well. Many working photographers do paid shoots, sell event photos to guests and keep a&lt;br&gt;
stock portfolio growing in the background. For the wider picture, see&lt;br&gt;
&lt;a href="https://sellphotos.online/blog/earn-money-photography-india?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;9 ways to earn money from photography in India&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft7i0gkpropd8jkrq04wv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft7i0gkpropd8jkrq04wv.png" alt="Where the money goes: the buyer pays the photographer directly" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Your first week
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Day 1.&lt;/strong&gt; Pick your way using the list above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 2.&lt;/strong&gt; Choose your 30 best photos that fit it. Be strict.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 3.&lt;/strong&gt; Stock: open a contributor account on Adobe Stock or Shutterstock and upload 10.
Events: ask one organiser if you may offer photos to their guests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 4.&lt;/strong&gt; Stock: write titles and keywords, fill in the W-8BEN. Events: set up the event and
your prices, and print the QR code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day 5 to 7.&lt;/strong&gt; Shoot something new on purpose, for the buyer you chose.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Questions people ask
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I really earn money by selling photos online in India?
&lt;/h3&gt;

&lt;p&gt;Yes. Stock sites pay small amounts per download and add up over years. Event photos pay more per&lt;br&gt;
sale because the buyer is in the photo. Neither is quick money without work.&lt;/p&gt;

&lt;h3&gt;
  
  
  How much does Shutterstock pay per photo in India?
&lt;/h3&gt;

&lt;p&gt;The same as everywhere: 15% to 40% of the licence price, with a minimum of $0.10 per download.&lt;br&gt;
New contributors start at 15%.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which is the best website to sell photos in India?
&lt;/h3&gt;

&lt;p&gt;For stock, Adobe Stock and Shutterstock have the most buyers. For event photos, a store where&lt;br&gt;
guests pay you directly by UPI. For your own audience, Instamojo. We compare twelve of them&lt;br&gt;
&lt;a href="https://sellphotos.online/blog/best-websites-to-sell-photos-online-india?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sell-photos-online-india" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I sell photos taken on my phone?
&lt;/h3&gt;

&lt;p&gt;Yes, if the file is at least 4 megapixels, sharp and in JPEG for stock sites. Phones are weakest&lt;br&gt;
at fast action and low light.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is it free to sell photos online?
&lt;/h3&gt;

&lt;p&gt;Joining the big stock sites is free, and they keep 60% to 85% of each sale. sellphotos.online&lt;br&gt;
takes no commission and charges a yearly plan instead. Free photo sites such as Pexels and&lt;br&gt;
Unsplash pay you nothing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I have to pay tax on this income?
&lt;/h3&gt;

&lt;p&gt;It is income, so it belongs in your tax return. GST registration generally becomes compulsory for&lt;br&gt;
service providers above ₹20 lakh of turnover a year (₹10 lakh in some states). This is not tax&lt;br&gt;
advice. Ask a CA once the income is regular.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need permission to sell a photo of someone?
&lt;/h3&gt;

&lt;p&gt;For commercial stock, yes: a signed model release. At events, get the organiser's permission&lt;br&gt;
first, and follow the school's or venue's photo policy, especially for children.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;About sellphotos.online: an online store for event photos. Upload a shoot, share one link or QR&lt;br&gt;
code, and guests find their photos with a selfie and pay you directly, with no commission.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>sideprojects</category>
      <category>career</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I pointed Claude Code at 338 launch directories. It submitted 285 of them.</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Wed, 11 Nov 2026 12:39:44 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/i-pointed-claude-code-at-338-launch-directories-it-submitted-285-of-them-27h5</link>
      <guid>https://dev.to/ashish_sikka/i-pointed-claude-code-at-338-launch-directories-it-submitted-285-of-them-27h5</guid>
      <description>&lt;p&gt;Directory submissions are the most boring part of launching anything. Same name, same tagline, same logo, same "Sign in with Google", three hundred times.&lt;/p&gt;

&lt;p&gt;I have three small products on new domains. In mid October, Ahrefs showed them at Domain Rating 3, 2 and 0. I did a handful of directories by hand and did the maths for the full list. At my estimate of about 40 minutes a site, it came to more than 200 hours. So I stopped and gave the job to Claude Code with a browser.&lt;/p&gt;

&lt;p&gt;This is the build log: what the setup looks like, what the agent could not do, and the numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers first
&lt;/h2&gt;

&lt;p&gt;For one product, sellphotos.online, the agents were sent to 338 directories. They submitted 285. When I last counted, 54 of those were live and most of the rest were sitting in review queues.&lt;/p&gt;

&lt;p&gt;Across five campaigns between October 13 and November 2 it was 822 directories attempted and 690 submitted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi8hvpjmko42c1vsu8zuy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi8hvpjmko42c1vsu8zuy.png" alt="Bar chart of five campaigns: sellphotos.online 285 of 338 submitted, SightRadar 165 of 213, Tapetide run one 92 of 116, SwipeToLaunch 97 of 101, Tapetide run two 51 of 54" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the Domain Rating readings, as Ahrefs showed them:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Product&lt;/th&gt;
&lt;th&gt;First reading&lt;/th&gt;
&lt;th&gt;Nov 7&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Tapetide&lt;/td&gt;
&lt;td&gt;DR 3 (Oct 12)&lt;/td&gt;
&lt;td&gt;DR 48&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SightRadar&lt;/td&gt;
&lt;td&gt;DR 2 (Oct 13)&lt;/td&gt;
&lt;td&gt;DR 36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sellphotos.online&lt;/td&gt;
&lt;td&gt;DR 0 (Oct 16)&lt;/td&gt;
&lt;td&gt;DR 33&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three products, all mine, so read it as an example and not a forecast. I also only tracked DR. I can't tell you how many signups came from this, and I don't trust anyone who says a directory made them rich.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attempt one: "go submit my product to directories"
&lt;/h2&gt;

&lt;p&gt;This fails in a boring way. The agent finds a "500 places to launch" list, opens the first site, and spends ten minutes hunting for the submit page. Then it meets a login wall. Then it finds out the free tier is gone. Then it guesses a category.&lt;/p&gt;

&lt;p&gt;The model is fine at filling a form. What it doesn't have is knowledge of the site. Every directory is its own small puzzle, and solving each one from scratch burns the whole context window.&lt;/p&gt;

&lt;h2&gt;
  
  
  What worked: one record per directory
&lt;/h2&gt;

&lt;p&gt;So I wrote the knowledge down. One JSON file per directory, with everything the agent needs before it opens the page. Trimmed, one looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"domain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"getmagictools.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"submit_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://getmagictools.com/submit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"login"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"none for the free listing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"badge_required"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"dofollow"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"yes"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"time_to_live"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"reviewed within 30 days"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"paid_tiers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Pro, $9.90 once (skip)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"steps"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;"Search the site for the product first, without dots in the query."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Open the submit page, fill in Tool Name and Tool URL."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Click Submit Tool and wait for 'Tool submitted successfully!'"&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"gotchas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;"No description field: the site writes the listing from your homepage, so check it once it's live."&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That record is an easy one. Others carry notes like "Continue with Google fails after the consent screen, use the email link" or "the badge must be in the server-rendered HTML or the check fails".&lt;/p&gt;

&lt;p&gt;Building the database was the real work. I collected 471 directories and opened every one:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm304vmailm3o10dzu1at.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm304vmailm3o10dzu1at.png" alt="471 directories checked: 318 have a free listing open, 83 flagged to skip as spam or link networks, 36 paid only, 18 could not be confirmed, 16 dead or closed" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Only 318 list you for free. 36 are paid only. 16 were dead. 83 I flagged to skip, mostly spam, including a group of 40 or so sites that turned out to be one backlink-farm network under different names.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rest of the setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A browser the agent drives.&lt;/strong&gt; Playwright MCP against a real Chrome profile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A separate Google account for launches,&lt;/strong&gt; signed in by me in that profile. About two thirds of submissions went through Sign in with Google (848 of 1,304 recorded results), and most of the rest wanted an email code. With the inbox open, the agent signs up, logs in and reads one-time codes by itself. It never types a password.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One listing file.&lt;/strong&gt; Name, taglines at several lengths, descriptions, categories, pricing. The agent trims it to each form's limits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Images in every size.&lt;/strong&gt; Forms ask for a 16:9 screenshot, a square icon, a 1400x950 preview. Render them once, up front.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A step log and a result file per site.&lt;/strong&gt; If the agent crashes or runs out of quota, it resumes from its own log and nothing gets submitted twice.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The rule that mattered most: giving up is a valid result
&lt;/h2&gt;

&lt;p&gt;Early on, the agent would loop on a form it couldn't finish. The fix was to make "hand it back to the human" an explicit outcome with a reason attached.&lt;/p&gt;

&lt;p&gt;Here is one session I timed on November 7, for a social media tool:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftran47os85px6d9eretq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftran47os85px6d9eretq.png" alt="One 31-minute session: 14 directories submitted by the agent, 8 handed back, 1 already listed. The 8 came back for two bot checks, two sign-ins on the wrong account, two fields it had no answer for, one listing that now costs 5 dollars, and one cookie banner" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thirty-one minutes, 23 directories. 14 submitted, 1 already listed, 8 handed back. The two sign-in failures were my fault: the Gmail tab that was open belonged to a different account. One form asked which popular tool the product replaces, and the agent stopped instead of inventing an answer. That's what I want. A guess on a form is a wrong listing I have to chase later.&lt;/p&gt;

&lt;p&gt;It also never pays for anything, and it never posts votes, comments or reviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell you before you try this
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The database beats the prompt.&lt;/strong&gt; Per-site notes are the difference between 14 submissions in half an hour and an agent wandering around a homepage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the badge rule first.&lt;/strong&gt; 160 of the 318 free directories want their badge on your site. Decide your policy before you start, not on site 40.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the report.&lt;/strong&gt; Directories email you three weeks later asking for changes. Without a file of every listing URL you won't remember where you signed up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expect it to go flat.&lt;/strong&gt; Directories get a new domain off zero. After that you need real links.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  If you want the shortcut
&lt;/h2&gt;

&lt;p&gt;I cleaned up the database, the per-site steps, the image pipeline and the tracker, and I sell it as the Launch Agent Kit. It's my product, so weigh this section accordingly. It's a folder your agent reads, and it works with Claude Code, Codex, Cursor, Antigravity, OpenCode, Copilot and Devin.&lt;/p&gt;

&lt;p&gt;It costs $29 once until December 1, then $99. If your domain starts at DR 0 to 10 and doesn't reach DR 30, you get your money back (the terms are on the page).&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://swipetolaunch.com/kit?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=kit-articles" rel="noopener noreferrer"&gt;swipetolaunch.com/kit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you'd rather build your own, everything above is enough to start. Ask me anything about the setup in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>showdev</category>
      <category>startup</category>
      <category>seo</category>
    </item>
    <item>
      <title>Watermarking 200 photos in the browser, with nothing uploaded</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Mon, 09 Nov 2026 04:28:02 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/watermarking-200-photos-in-the-browser-with-nothing-uploaded-3p13</link>
      <guid>https://dev.to/ashish_sikka/watermarking-200-photos-in-the-browser-with-nothing-uploaded-3p13</guid>
      <description>&lt;p&gt;&lt;em&gt;I work on &lt;a href="https://sellphotos.online/blog/browser-batch-watermark?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=browser-batch-watermark" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt;, where this was originally published.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A watermark tool that uploads your photos to a server asks photographers to hand over the very thing they're trying to protect. So we built &lt;a href="https://sellphotos.online/tools/photo-watermark?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=browser-batch-watermark" rel="noopener noreferrer"&gt;ours&lt;/a&gt; to run entirely in the tab. You drop in up to 200 photos, set a mark, and get back one file or a zip. Nothing is sent anywhere.&lt;/p&gt;

&lt;p&gt;The interesting part is that it isn't a separate project. The tool draws its watermarks with the same code our server uses for photos that are actually for sale.&lt;/p&gt;

&lt;h2&gt;
  
  
  One renderer, two rasterisers
&lt;/h2&gt;

&lt;p&gt;sellphotos.online is a store for event photographers. When a photographer uploads a shoot, a processing container (Node 22 with sharp and libvips) draws a watermark over each preview that buyers browse. Those designs live in a folder of plain TypeScript, with no enums and imports written with &lt;code&gt;.ts&lt;/code&gt; extensions. Node 22 strips the types at load time in the container, and Vite bundles the same files into the web app.&lt;/p&gt;

&lt;p&gt;The core function returns an SVG string sized to one photo's frame:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;renderWatermark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// → { svg, usedLogo }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the server, librsvg rasterises that SVG and sharp composites it. In the browser, the SVG is loaded into an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; and drawn onto a canvas over the photo. Same SVG, two rasterisers, so the SVG may only use features both draw the same way. We learned the rules by measuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No &lt;code&gt;textPath&lt;/code&gt;, &lt;code&gt;textLength&lt;/code&gt; or &lt;code&gt;text-transform&lt;/code&gt;.&lt;/strong&gt; Letter-spaced text is anchored at its measured start, because browsers count trailing letter-spacing when centring and librsvg doesn't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeated text is &lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt; copies inside a rotated group,&lt;/strong&gt; not a rotated &lt;code&gt;&amp;lt;pattern&amp;gt;&lt;/code&gt;. At 2048 px the pattern took 1.8 s in the container and the group 0.3 s.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No blur, shadow or morphology filters.&lt;/strong&gt; They cost 6–10 s per photo on the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Marks without a plate get a thin contrasting outline,&lt;/strong&gt; so a white mark stays visible on a white sky.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Layout from the short edge
&lt;/h2&gt;

&lt;p&gt;A batch mixes portraits, landscapes and squares, so a mark sized in pixels would look tiny on one photo and huge on the next. Every design sizes from the frame's short edge instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// workers/processor/container/wm/render.ts (simplified)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;base&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;margin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;frac&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.035&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;base&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;frac&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sz&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;frac&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;base&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;frac&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// k = the user's size setting&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each photo in the batch gets its own SVG, rendered for its own width and height. A name in the corner sits the same distance in from the edge on a phone portrait as on a 3:2 landscape.&lt;/p&gt;

&lt;h2&gt;
  
  
  Branding marks, kept away from the store
&lt;/h2&gt;

&lt;p&gt;The free tool has something the paid product deliberately doesn't: corner and edge marks. You pick a spot on a 3×3 grid (or every corner), a style (plain, badge, strip or a script signature), and whether a logo sits beside or above your text.&lt;/p&gt;

&lt;p&gt;Those marks never reach a seller's previews. A corner mark is cropped off in seconds, so every design a seller can choose either crosses the middle of the photo or tiles the whole frame. The branding marks live in their own module, and the processor never sees them.&lt;/p&gt;

&lt;p&gt;To keep the tool's preview and export code identical to the seller designs, a branding mark still travels as one number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// workers/processor/container/wm/branding.ts (simplified)&lt;/span&gt;
&lt;span class="c1"&gt;// id = 1000 + style × 100 + layout × 10 + position&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderMark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;opts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;isBrandingId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;renderBranding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;renderWatermark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The font problem
&lt;/h2&gt;

&lt;p&gt;An SVG loaded as an image is sandboxed. It can't fetch anything, including web fonts, so text silently falls back to a system font. The fix is to read which faces the SVG actually uses and inline those font files as &lt;code&gt;data:&lt;/code&gt; URIs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/web/app/lib/tools/watermark-export.ts (simplified)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fontFacesIn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;FontFace&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;FontFace&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matchAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/font-family="&lt;/span&gt;&lt;span class="se"&gt;([^&lt;/span&gt;&lt;span class="sr"&gt;",&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;+&lt;/span&gt;&lt;span class="se"&gt;)[^&lt;/span&gt;&lt;span class="sr"&gt;"&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;*" font-weight="&lt;/span&gt;&lt;span class="se"&gt;(\d&lt;/span&gt;&lt;span class="sr"&gt;+&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;"&lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt; font-style="italic"&lt;/span&gt;&lt;span class="se"&gt;)?&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]}${&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/italic&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;FONT_FILES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="na"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]),&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;italic&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;normal&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;()];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each woff2 is fetched once per page, base64-encoded, and cached in a &lt;code&gt;Map&lt;/code&gt; of promises. A failed fetch is evicted so the next export retries it. The &lt;code&gt;@font-face&lt;/code&gt; rules go into a &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; block inside the SVG, right after the opening tag. They're Latin subsets of the same font files the container has installed, so a mark looks the same in the tool as on a store's previews.&lt;/p&gt;

&lt;h2&gt;
  
  
  Export: one canvas at a time
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// simplified&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;photoObjectUrl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;outputFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;naturalWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;naturalHeight&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// long edge ≤ 4,096 px&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;svg&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;renderMark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;overlay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Blob&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nf"&gt;withStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;embeddedFontCss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;))],&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;image/svg+xml&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;})));&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;canvas&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drawImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drawImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;overlay&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;toBlob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;image/jpeg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mf"&gt;0.92&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool accepts JPEG, PNG and WebP up to 25 MB each. PNG stays PNG, because it may carry transparency, and everything else comes back as JPEG at quality 0.92. The long edge is capped at 4,096 px, plenty for the web and social media, and the original file on disk is never touched.&lt;/p&gt;

&lt;p&gt;Photos are processed one after another, each on its own full-size canvas. So the 200-photo limit is about patience and zip size rather than memory. A cancel flag is checked between photos, and a cancelled batch saves nothing. When a photo is added, one object URL is created and reused by both the preview and the export, and a 320 px JPEG thumbnail is made for the list.&lt;/p&gt;

&lt;h2&gt;
  
  
  A zip writer in a few dozen lines
&lt;/h2&gt;

&lt;p&gt;Browsers have no built-in zip writer, and the server's streaming one relies on &lt;code&gt;node:zlib&lt;/code&gt;. JPEG and PNG files are already compressed, though, so a zip that only &lt;em&gt;stores&lt;/em&gt; files loses almost nothing. That format is simple enough to write by hand: a CRC-32 per file, a local header before each file's bytes, a central directory and an end record.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/web/app/lib/tools/client-zip.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;crc32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;crc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt; &lt;span class="o"&gt;??=&lt;/span&gt; &lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint32Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mh"&gt;0xedb88320&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;})());&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;crc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0xff&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Names are written as UTF-8 (general-purpose flag &lt;code&gt;0x0800&lt;/code&gt;), and times as MS-DOS date/time. Files with the same name become &lt;code&gt;a.jpg&lt;/code&gt; and &lt;code&gt;a (2).jpg&lt;/code&gt;, compared case-insensitively. The detail that matters most for big batches is in &lt;code&gt;zipBlobs&lt;/code&gt;. It reads each &lt;code&gt;Blob&lt;/code&gt; once to compute its CRC, then puts the Blob itself into the output instead of a copy of its bytes. The whole batch stays in the browser's blob store, not in the page's JavaScript heap.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "nothing uploads" buys you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Trust you can check.&lt;/strong&gt; Open the network tab while you export: there are no requests carrying your photos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No server cost per photo,&lt;/strong&gt; so the tool can be free with no limits or sign-up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The trade-offs are honest ones.&lt;/strong&gt; Output is capped at 4,096 px, and a big batch on an old phone takes a while. For photos you're about to post or send to a client, that's usually fine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you watermark photos you mean to sell, a corner mark won't stop anyone. That's why the paid side of sellphotos.online uses full-frame designs and only releases the clean original after the buyer has paid you. The &lt;a href="https://sellphotos.online/tools/photo-watermark?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=browser-batch-watermark" rel="noopener noreferrer"&gt;watermark tool&lt;/a&gt; is free either way, with no account needed.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Notes on generating QR codes for print: error correction, logo holes and quiet zones</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Mon, 09 Nov 2026 04:25:59 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/notes-on-generating-qr-codes-for-print-error-correction-logo-holes-and-quiet-zones-2cm0</link>
      <guid>https://dev.to/ashish_sikka/notes-on-generating-qr-codes-for-print-error-correction-logo-holes-and-quiet-zones-2cm0</guid>
      <description>&lt;p&gt;&lt;em&gt;I work on &lt;a href="https://sellphotos.online/blog/print-ready-qr-codes-logo?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=print-ready-qr-codes-logo" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt;, where this was originally published.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every event on sellphotos.online gets a QR code. Photographers print it on posters, notice boards and table cards, or put it on the last slide at a prize-giving. Guests scan it in poor light, at an angle, through glare on a laminated sheet. We generate the codes ourselves with the small &lt;code&gt;uqr&lt;/code&gt; encoder, then draw them with our own code. These are the decisions that came out of that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick the error correction level per medium
&lt;/h2&gt;

&lt;p&gt;QR codes carry Reed-Solomon error correction at four levels. Roughly, these are the share of codewords that can be recovered:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;level&lt;/th&gt;
&lt;th&gt;recoverable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;L&lt;/td&gt;
&lt;td&gt;~7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;M&lt;/td&gt;
&lt;td&gt;~15%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Q&lt;/td&gt;
&lt;td&gt;~25%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H&lt;/td&gt;
&lt;td&gt;~30%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Higher levels need more modules for the same data, so at a fixed print size each module gets smaller. We use three levels, one for each place a code ends up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;M&lt;/strong&gt; for codes read off a screen. These are the UPI and Pix payment codes on a buyer's order page. A screen is flat, lit and clean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Q&lt;/strong&gt; for printed event codes. Paper gets scuffed, laminate catches glare, and cheap printers blur edges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;H&lt;/strong&gt; when a logo sits in the middle, because the logo hides modules on purpose.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For scale: a 35-character event link such as &lt;code&gt;https://sellphotos.online/e/AbC1234&lt;/code&gt; comes out as version 3 (29×29 modules) at M, version 4 (33×33) at Q and version 5 (37×37) at H.&lt;/p&gt;

&lt;h2&gt;
  
  
  The logo hole
&lt;/h2&gt;

&lt;p&gt;Plenty of generators paste a logo over the finished code and count on error correction to cope. We clear a square of modules first and draw the logo inside it, with a little padding, so no dark modules peek out around a transparent logo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/web/app/lib/qr.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;LOGO_RATIO&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.24&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;logoHole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;QrMatrix&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ratio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;LOGO_RATIO&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;QrHole&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;ratio&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// same parity: exactly centred&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parity line is easy to miss. A QR code's side is always odd (21 + 4 × (version − 1)), so an even-sized hole can't sit exactly in the middle. &lt;code&gt;(size − hole) / 2&lt;/code&gt; would land on a half module. Bumping the hole to the same parity keeps it centred on whole modules.&lt;/p&gt;

&lt;p&gt;The hole is 24% of the side. At version 5 with H, that's a 9×9 hole in a 37×37 code: 81 of 1,369 modules, about 6%. H can recover about 30%, so most of that margin is left for scuffs, glare and print blur. That's an approximation, since modules map onto codewords unevenly and codewords are interleaved across blocks. Even so, a hole of a few percent behind a ~30% budget leaves real slack.&lt;/p&gt;

&lt;p&gt;Also check where the function patterns are. At version 5, the only alignment pattern sits near the bottom-right corner, well clear of a hole spanning modules 14 to 22. From version 7 up, alignment patterns appear in the centre as well, so a long URL with a logo would put one under the logo. Short links matter here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quiet zone, and a caption that stays out of it
&lt;/h2&gt;

&lt;p&gt;The standard (ISO/IEC 18004) asks for four light modules on every side, and we keep all four. Photographers can add the event title as a caption. It goes in its own band below the quiet zone, so the zone stays clear. Long titles are cut at 40 characters, and the font size comes from a rough width estimate (a bold sans is about 0.58 em per glyph), so we never measure text.&lt;/p&gt;

&lt;h2&gt;
  
  
  One path string, three outputs
&lt;/h2&gt;

&lt;p&gt;The Share dialog shows a live preview and offers an SVG download, PNGs and a printable table card. They all come from one function that turns the matrix into SVG path data, in module units:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// square style (simplified): each row's dark runs become one rectangle&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`M&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;h&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;v1h-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;z`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Merging runs keeps the path short. The rounded style draws data modules as dots of radius 0.48, slightly under half a module so they stay distinct. It draws the finder patterns as nested rounded squares and fills them with &lt;code&gt;evenodd&lt;/code&gt;, which punches out their holes.&lt;/p&gt;

&lt;p&gt;That one string feeds three renderers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the React preview, as &lt;code&gt;&amp;lt;path d={…}&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;the SVG download, where the path goes into a standalone document on a white background&lt;/li&gt;
&lt;li&gt;the PNG, drawn on a canvas with &lt;code&gt;ctx.fill(new Path2D(d), "evenodd")&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We never draw an SVG onto the canvas through an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;. That keeps us clear of canvas tainting and of &lt;code&gt;img-src&lt;/code&gt; rules for &lt;code&gt;data:&lt;/code&gt; and &lt;code&gt;blob:&lt;/code&gt; URLs, and because every output comes from the same geometry, they always match.&lt;/p&gt;

&lt;p&gt;A few details on the PNG side:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Whole pixels per module.&lt;/strong&gt; &lt;code&gt;modulePx = Math.floor(width / side)&lt;/code&gt;, and the code is centred in what's left over. A fractional module size blurs the edges between modules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A size cap.&lt;/strong&gt; The canvas stops at 4096 × 4096 pixels. The printable table card is A6 portrait at about 300 dpi (1240 × 1748 px).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fonts first.&lt;/strong&gt; A canvas doesn't wait for web fonts, so we &lt;code&gt;await document.fonts.load(...)&lt;/code&gt; before drawing the caption. Otherwise the first download comes out in a fallback font.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The logo inside the SVG&lt;/strong&gt; is embedded as a PNG &lt;code&gt;data:&lt;/code&gt; URL, so the file stands alone when it goes to a print shop. It's re-encoded to PNG because design and print tools read PNG inside SVG, but not always WebP.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Colour
&lt;/h2&gt;

&lt;p&gt;Photographers can pick a colour for the modules. We compute the WCAG contrast ratio against white and warn below 4.5. Our own note in the code puts the point where codes may stop scanning at about 3, so the warning fires with a margin to spare.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping the encoder out of the client bundle
&lt;/h2&gt;

&lt;p&gt;The encoder is small, but most visitors never need it, so we keep it out of the main bundle in two ways.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Lazy loading for sellers.&lt;/strong&gt; The Share dialog loads its QR tab on demand, so &lt;code&gt;uqr&lt;/code&gt; ships only in that chunk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server-only for buyers.&lt;/strong&gt; The UPI payment code on a buyer's order page is built in the route's loader. React Router's client build drops loaders, and the QR module and &lt;code&gt;uqr&lt;/code&gt; go with it. The browser receives a side length and a path string, and fills a &lt;code&gt;Path2D&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/web/app/routes/buyer/order.tsx (simplified)&lt;/span&gt;
&lt;span class="c1"&gt;// Loader only: used in a component, this would ship the encoder to every buyer.&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;upiHandoff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;UpiPayment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;upiUri&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;matrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;encodeQr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// read off a screen&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;qr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;side&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;QUIET_ZONE&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;qrModulePath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comment is there for the next person to touch that file. One import from a component would quietly put the encoder back into every buyer's download.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we'd check before trusting a design
&lt;/h2&gt;

&lt;p&gt;None of this replaces printing the thing. Before calling a style or logo size done, we'd print it at the size people will actually use, scan it from across a room with an older phone, and try it under a ceiling light reflecting off laminate. The numbers above say how much damage a code should survive. Testing on paper shows whether it does.&lt;/p&gt;

&lt;p&gt;The code above lives in a photo-selling app. Each event's QR code opens a gallery where guests find their photos with a selfie. If you're curious what's at the other end of the scan, there's a &lt;a href="https://sellphotos.online/demo?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=print-ready-qr-codes-logo" rel="noopener noreferrer"&gt;sample gallery&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How we built selfie search for event photos on Cloudflare (and kept the originals out of it)</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Mon, 09 Nov 2026 04:21:57 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/how-we-built-selfie-search-for-event-photos-on-cloudflare-and-kept-the-originals-out-of-it-2am7</link>
      <guid>https://dev.to/ashish_sikka/how-we-built-selfie-search-for-event-photos-on-cloudflare-and-kept-the-originals-out-of-it-2am7</guid>
      <description>&lt;p&gt;&lt;em&gt;I work on &lt;a href="https://sellphotos.online/blog/selfie-search-event-photos-cloudflare?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=selfie-search-event-photos-cloudflare" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt;, where this was originally published.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Our sample gallery has 1,240 photos from a school spring festival. A parent opens it on their phone, takes one selfie, and sees "7 photos of you". Behind that one tap sits a pipeline that takes 100 MB originals from a photographer's browser, turns them into watermarked previews, and indexes faces, without the originals ever leaving storage.&lt;/p&gt;

&lt;p&gt;sellphotos.online is a store for event photographers. They upload a shoot and share one link or QR code. Guests find their photos with a selfie and pay the photographer directly. This post covers the plumbing. Three constraints shaped all of it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The originals are the product.&lt;/strong&gt; Buyers pay for them. A leaked original is a lost sale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guests won't install an app.&lt;/strong&gt; They're at a gate or in a WhatsApp group, opening a link on whatever phone they have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Photographers upload thousands of files at once,&lt;/strong&gt; in whatever their camera or phone writes, including iPhone HEIC.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The app is React Router (framework mode, SSR) on Cloudflare Workers, with D1, R2, Queues and a Cloudflare Container for image work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The whole pipeline
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;photographer's browser
  │  presigned PUT (≤ 20 MiB) or multipart (10 MiB parts)
  ▼
R2 originals ──(object-create notification)──▶ Queue ──▶ processor Worker
                                                              │ streams the original in
                                                              ▼
                                               Container: Node 22 + sharp/libvips
                                               (no internet, no credentials)
                                                              │ meta + watermarked WebP + smaller sizes
                                                              ▼
                                processor Worker: writes previews to R2, status = ready in D1
                                                              │
                                                              ▼
                                face indexing: the gateway fetches the WATERMARKED preview

guest's phone ─▶ gallery of previews ─▶ selfie ─▶ matches ─▶ pays the photographer ─▶ approved ─▶ original
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1. Uploads go straight from the browser to R2
&lt;/h2&gt;

&lt;p&gt;The Worker never proxies photo bytes on the way in. The browser asks for upload slots, up to 50 files per call. The app checks the plan's quota, inserts rows with status &lt;code&gt;uploading&lt;/code&gt;, and returns presigned URLs: one PUT for files up to 20 MiB, or a multipart upload with one presigned part per 10 MiB above that. The URLs live for an hour and can be re-minted while the photo is still uploading.&lt;/p&gt;

&lt;p&gt;Two details matter more than they look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The client never picks the object key.&lt;/strong&gt; Keys are &lt;code&gt;{storeId}/{photoId}.{ext}&lt;/code&gt;, the extension comes from the MIME type, and the store and photo IDs are signed into the URL as object metadata. The original filename lives only in the database, after normalisation: bidi controls are stripped, so a &lt;code&gt;U+202E&lt;/code&gt; can't fake an extension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Duplicates are caught twice.&lt;/strong&gt; Before uploading, the browser asks which files the event already has. It matches on name, size and &lt;code&gt;lastModified&lt;/code&gt; first, then MD5-hashes only the size matches, so re-dropping a folder doesn't re-upload it. Those browser hashes are hints, though. The processor computes the MD5 of the original and has the final say.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. R2 tells a queue, and a backup message covers lost events
&lt;/h2&gt;

&lt;p&gt;An object-create notification on the originals bucket puts a message on a Queue. Before doing anything, the processor checks three things: the key is canonical, it matches the row's &lt;code&gt;original_key&lt;/code&gt;, and its prefix is the row's store.&lt;/p&gt;

&lt;p&gt;Event notifications can go missing, so there's a second path. When the browser calls &lt;code&gt;/uploads/complete&lt;/code&gt;, the app enqueues a &lt;code&gt;render&lt;/code&gt; message delayed by 15 minutes, which only acts on a photo still stuck in &lt;code&gt;processing&lt;/code&gt;. An hourly reconciler picks up anything both of them miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A container that can't call anyone
&lt;/h2&gt;

&lt;p&gt;The processor Worker streams the original into a Cloudflare Container running Node 22 with sharp and libvips. The container decodes and auto-orients the photo, then draws one of 27 watermark designs. It sends back a multipart response with three parts: JSON metadata (MD5, dimensions, capture time, dominant colour), a 2048 px WebP preview, and smaller sizes.&lt;/p&gt;

&lt;p&gt;The container runs with &lt;code&gt;enableInternet = false&lt;/code&gt; and holds no credentials. The Worker does every R2 and D1 write itself.&lt;/p&gt;

&lt;p&gt;The reason is HEIC. sharp's prebuilt libvips can't decode HEVC, so HEIC files go through libheif's &lt;code&gt;heif-convert&lt;/code&gt; to a lossless PNG first. libheif and libde265 are C/C++ parsers of untrusted input, with a steady stream of memory-safety CVEs. We pin libheif to an upstream release and build only the HEVC decoder. Its default security limits stay on, sharp's 300 MP pixel limit is checked against the header before decoding, and it runs via &lt;code&gt;execFile&lt;/code&gt; with fixed arguments.&lt;/p&gt;

&lt;p&gt;All of that helps, but the real defence is the box. Suppose someone got code execution inside the decoder. They could reach the one image they were handed and nothing else: no bucket, no other store's photos, no network.&lt;/p&gt;

&lt;p&gt;HEIC had other surprises:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gain maps.&lt;/strong&gt; iOS 18 HEICs carry an ISO 21496-1 gain map, roughly 40% of the photos in a recent iPhone library. The older libheif in Debian bookworm refused every one of them. The preview now uses the SDR base image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Orientation, once.&lt;/strong&gt; libheif applies &lt;code&gt;irot&lt;/code&gt;/&lt;code&gt;imir&lt;/code&gt;, and iPhones also write EXIF Orientation, so that path must not auto-orient a second time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Colour.&lt;/strong&gt; iPhones embed a Display P3 profile. Some Android phones signal P3 only through an &lt;code&gt;nclx&lt;/code&gt; box, so we insert the P3 profile before converting to sRGB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bursts and edited stacks&lt;/strong&gt; have several top-level images. We keep the primary one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Watermark or nothing
&lt;/h3&gt;

&lt;p&gt;This rule has the most code behind it. No code path copies original bytes into the previews bucket. The container rasterises the overlay as its own RGBA layer, then counts its visible pixels:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// workers/processor/container/watermark.js (simplified)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MIN_COVERAGE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0005&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 0.05% of the frame&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;visible&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;MIN_COVERAGE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WatermarkError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`design &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;designId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; produced an empty overlay`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;watermark_empty&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A bad SVG, a logo that won't decode or an empty overlay each returns a permanent &lt;code&gt;422&lt;/code&gt;, and the Worker only writes previews from a &lt;code&gt;200&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Smaller sizes are drawn, not downscaled
&lt;/h3&gt;

&lt;p&gt;Phones load images from 320 to 1536 px wide. Downscaling the 2048 px preview was the obvious move, but fine watermark patterns average away when you shrink them. We measured the share of pixels the mark visibly changes, per mille, over six real photos:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;design&lt;/th&gt;
&lt;th&gt;2048&lt;/th&gt;
&lt;th&gt;320, downscaled&lt;/th&gt;
&lt;th&gt;320, drawn at 320&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Microtext&lt;/td&gt;
&lt;td&gt;71&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;57&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Diamonds&lt;/td&gt;
&lt;td&gt;39&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brick&lt;/td&gt;
&lt;td&gt;108&lt;/td&gt;
&lt;td&gt;39&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tiled&lt;/td&gt;
&lt;td&gt;75&lt;/td&gt;
&lt;td&gt;70&lt;/td&gt;
&lt;td&gt;69&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So the container draws the watermark again at 1536, 1024, 640, 480 and 320 px. It costs CPU: when we added the four smaller sizes, a render of about a second on an M3 got roughly 0.4 s slower. In exchange, a 320 px thumbnail is as hard to reuse as the full preview.&lt;/p&gt;

&lt;p&gt;Each photo is also rendered exactly once. Changing your watermark later only affects new uploads, so a store with 50,000 photos doesn't re-decode 50,000 originals over a logo tweak.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Retries that don't lie
&lt;/h2&gt;

&lt;p&gt;Queues deliver at least once, and the container can be busy, restarting or gone. Each failure gets its own lane:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;failure&lt;/th&gt;
&lt;th&gt;what happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;container busy (&lt;code&gt;503 busy&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;ack, re-send as a new message, backoff 15 s → 5 min; doesn't use up retries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;container unreachable&lt;/td&gt;
&lt;td&gt;re-send, backoff 60 s → 8 min, for up to 30 min&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;transient (5xx, D1, R2)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;message.retry()&lt;/code&gt; at 30 / 60 / 120 s with jitter; &lt;code&gt;max_retries&lt;/code&gt; 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;permanent (bad file, broken logo)&lt;/td&gt;
&lt;td&gt;marked failed now; the photographer can press Retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;still failing after all that&lt;/td&gt;
&lt;td&gt;the dead-letter consumer marks it failed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Back-pressure shouldn't eat a photo's retry budget. Queues has no retry that doesn't count, so "busy" and "unreachable" become fresh messages that carry their own counters in the body.&lt;/p&gt;

&lt;p&gt;D1 has no transactions you can hold open and no row locks, so correctness comes from guarded statements. The final write looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- simplified&lt;/span&gt;
&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;photos&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ready'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;preview_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;md5&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;deleted_at&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;original_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ready'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;preview_key&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first render to commit wins. If zero rows change, either the photo was deleted mid-flight or a duplicate delivery got there first, and the preview we just wrote gets cleaned up. The duplicate check works the same way: one atomic &lt;code&gt;batch()&lt;/code&gt; sets the MD5, soft-deletes newer copies in the same event (never one that has sold), and queues their R2 deletes.&lt;/p&gt;

&lt;p&gt;Capacity is matched end to end. Ten container instances run two images each, so 20 at once, and the consumer runs &lt;code&gt;max_concurrency&lt;/code&gt; 4 × &lt;code&gt;max_batch_size&lt;/code&gt; 5, also 20.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Face indexing sees only what the public sees
&lt;/h2&gt;

&lt;p&gt;Faces are indexed by SightRadar, our face-recognition service, with one collection per event. We don't send it files. It fetches each photo's watermarked preview from the public image route at &lt;code&gt;?w=2048&lt;/code&gt;, and that route has no code path to the originals bucket.&lt;/p&gt;

&lt;p&gt;Indexing is batched, up to 1,000 photos at a time, and arranged so a crash can neither lose a batch nor pay for it twice:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In one D1 batch, write an &lt;code&gt;intent&lt;/code&gt; row and mark the photos &lt;code&gt;sent&lt;/code&gt;. The idempotency key is a hash of the sorted photo IDs and their attempt counts.&lt;/li&gt;
&lt;li&gt;Submit the batch under that key.&lt;/li&gt;
&lt;li&gt;If the Worker dies between steps 1 and 2, the next run re-submits the intent under the same key. The gateway replays a key it has already seen without charging again.&lt;/li&gt;
&lt;li&gt;Poll the batch with backoff for about an hour. When configured, a signed webhook (HMAC-SHA256 over timestamp and body, ±300 s) settles results sooner.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  6. The guest side: a link, a camera, no app
&lt;/h2&gt;

&lt;p&gt;The guest scans a QR code on a poster and lands in a gallery of previews. "Find my photos" opens a short notice first, covering what a face template is, that it's used for this event only, and how long it's kept. The camera opens only after "Agree and take a selfie".&lt;/p&gt;

&lt;p&gt;The camera is plain &lt;code&gt;getUserMedia&lt;/code&gt;. It opens front-facing, mirrored in the preview, though the image that's sent isn't mirrored. "Find someone else" opens the rear camera, for a parent photographing their child. The phone checks the selfie before anything is uploaded. A photo under 160 px on its short side, one that's too dark (95th-percentile luma under 50), or one with two faces of similar size (where the browser has &lt;code&gt;FaceDetector&lt;/code&gt;) is refused locally, without using up a search.&lt;/p&gt;

&lt;p&gt;On the server, the selfie image is never stored. It becomes a face template, and the search result is cached for 24 hours for the browser that made it. Photographers can turn on "Live camera only", so nobody can search with someone else's photo from their camera roll. They can also delete an event's face data entirely.&lt;/p&gt;

&lt;p&gt;Then the guest buys single photos, "all my photos" or the whole event. They pay the photographer directly, by UPI, PayPal, bank transfer or whatever the photographer accepts, and upload a screenshot. Once the photographer approves, &lt;code&gt;/dl&lt;/code&gt; checks the buyer's entitlement and streams the original from R2 with &lt;code&gt;Cache-Control: private, no-store&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we'd tell someone building this
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Put the parser of untrusted files in a box with no network.&lt;/strong&gt; Then keep patching it anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On D1, write every multi-step change as one &lt;code&gt;batch()&lt;/code&gt; guarded by &lt;code&gt;WHERE&lt;/code&gt; clauses.&lt;/strong&gt; "First commit wins, then clean up" is simpler than locks you don't have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give back-pressure its own retry counter.&lt;/strong&gt; Otherwise one busy hour fails good photos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure what the user actually sees.&lt;/strong&gt; We almost shipped thumbnails whose watermark had mostly vanished.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send the face service the same image the public sees.&lt;/strong&gt; Then "what if it leaks?" has a boring answer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's next: AVIF came in at about half the bytes of WebP at 1024 px, but it encodes about twice as slowly and needs a &lt;code&gt;Vary: Accept&lt;/code&gt; that our cache keys don't have, so it's parked for now.&lt;/p&gt;

&lt;p&gt;If you want to see the guest side without uploading anything, there's a &lt;a href="https://sellphotos.online/demo?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=selfie-search-event-photos-cloudflare" rel="noopener noreferrer"&gt;sample gallery with a simulated selfie search&lt;/a&gt;. Questions about any of the pieces above are welcome in the comments.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>cloudflare</category>
      <category>webdev</category>
      <category>serverless</category>
    </item>
    <item>
      <title>How a photo marketplace cut its face search bill 56% by moving off AWS Rekognition</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Fri, 06 Nov 2026 10:31:44 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/how-a-photo-marketplace-cut-its-face-search-bill-56-by-moving-off-aws-rekognition-205h</link>
      <guid>https://dev.to/ashish_sikka/how-a-photo-marketplace-cut-its-face-search-bill-56-by-moving-off-aws-rekognition-205h</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article was written with AI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: I work on SightRadar, the API this team moved to. The figures for &lt;a href="https://sellphotos.online" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt; are the ones they reported, and the full case study is at &lt;a href="https://sightradar.com/customers/sellphotos" rel="noopener noreferrer"&gt;sightradar.com/customers/sellphotos&lt;/a&gt;. The audit scripts below run against your own Rekognition account, whatever you decide afterwards.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sellphotos.online" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt; sells event photos. Photographers upload weddings, marathons and corporate events, a guest uploads a selfie, and face search finds every photo that guest is in. They ran it on AWS Rekognition until the bill reached about $3,500 a month. After moving to SightRadar they pay about $1,550, for the same photos and the same number of searches. By their figures that is 56% less. They also found more faces in crowd shots, which had been their bigger complaint.&lt;/p&gt;

&lt;p&gt;This post breaks a Rekognition face search bill into its three lines, shows how to measure each one from your own account, and then covers what changed for them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three lines on a face search bill
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Indexing.&lt;/strong&gt; Every &lt;code&gt;IndexFaces&lt;/code&gt; call is billed per image. In us-east-1 the first million Group 1 images a month cost $0.0010 each.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Searching.&lt;/strong&gt; &lt;code&gt;SearchFacesByImage&lt;/code&gt; (search with a selfie) and &lt;code&gt;SearchFaces&lt;/code&gt; (search with a stored face id) are Group 1 calls at the same per-image rate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage.&lt;/strong&gt; Every face you keep in a collection is a stored face vector, billed at $0.00001 per vector per month, which is $10 per million faces. AWS applies the charge monthly and pro-rates partial months (&lt;a href="https://aws.amazon.com/rekognition/pricing/" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;). User vectors are billed the same way.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first two lines follow traffic. The third follows what you keep, so it is charged every month whether anyone searches the collection or not. It is also per face, not per photo: a group shot with 40 people in it adds up to 40 vectors.&lt;/p&gt;

&lt;p&gt;For a young platform, storage is small. For an event platform that keeps years of past events searchable, it becomes a fixed monthly cost that keeps growing unless you delete old collections.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F286iq6p3p1xj30zlmsei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F286iq6p3p1xj30zlmsei.png" alt="Grouped bar chart of the monthly charge for keeping faces in a collection, at list prices. 10M faces: $100 on AWS Rekognition, $60 on SightRadar. 25M: $250 and $150. 50M: $500 and $300. 100M: $1,000 and $600." width="800" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The chart is list-price arithmetic, not sellphotos.online's data. Their case study does not attribute any of their saving to storage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure your storage line
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;DescribeCollection&lt;/code&gt; returns &lt;code&gt;FaceCount&lt;/code&gt; and &lt;code&gt;UserCount&lt;/code&gt; for each collection. Multiply by the list price and you have the storage line before the invoice arrives. Collections are regional, so run it for every region you use, and change the price if yours differs from us-east-1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;REGION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us-east-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;PER_VECTOR_MONTH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.00001&lt;/span&gt;  &lt;span class="c1"&gt;# us-east-1 list price for face and user vectors
&lt;/span&gt;
&lt;span class="n"&gt;rek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rekognition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;REGION&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_paginator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;list_collections&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;paginate&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;cid&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CollectionIds&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe_collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;vectors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FaceCount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UserCount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;vectors&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;cid&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;vectors&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;  $&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;vectors&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PER_VECTOR_MONTH&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/month&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;  $&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PER_VECTOR_MONTH&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/month&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sort the output and look at the biggest collections. If some belong to events nobody has searched in a year, the cheapest fix needs no migration at all: set a retention window and delete collections once they pass it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Count the faces you are not indexing
&lt;/h2&gt;

&lt;p&gt;Cost was half of their problem. The other half was guests who searched and came up empty because their face in the back row of a group shot was never indexed.&lt;/p&gt;

&lt;p&gt;Rekognition tells you about some of those faces. &lt;code&gt;IndexFaces&lt;/code&gt; returns &lt;code&gt;UnindexedFaces&lt;/code&gt;, each with a list of &lt;code&gt;Reasons&lt;/code&gt; such as &lt;code&gt;SMALL_BOUNDING_BOX&lt;/code&gt;, &lt;code&gt;LOW_FACE_QUALITY&lt;/code&gt; or &lt;code&gt;EXCEEDS_MAX_FACES&lt;/code&gt;. By default, &lt;code&gt;IndexFaces&lt;/code&gt; chooses the quality bar that filters detected faces. It also indexes at most 100 faces per image. When it has more faces than &lt;code&gt;MaxFaces&lt;/code&gt;, it drops the lowest quality ones first, then the smallest (&lt;a href="https://docs.aws.amazon.com/rekognition/latest/APIReference/API_IndexFaces.html" rel="noopener noreferrer"&gt;API reference&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Run a sample of your hardest photos into a scratch collection and tally the reasons:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;REGION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us-east-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;rek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rekognition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;REGION&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;BUCKET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your-photo-bucket&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;# must be in the same region as the client
&lt;/span&gt;&lt;span class="n"&gt;sample_keys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...]&lt;/span&gt;  &lt;span class="c1"&gt;# a few hundred crowd shots from one event
&lt;/span&gt;&lt;span class="n"&gt;SCRATCH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;audit-scratch&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;SCRATCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;indexed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reasons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sample_keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;index_faces&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;SCRATCH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;S3Object&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Bucket&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BUCKET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;}},&lt;/span&gt;
            &lt;span class="c1"&gt;# ExternalImageId allows only [a-zA-Z0-9_.\-:], up to 255 characters
&lt;/span&gt;            &lt;span class="n"&gt;ExternalImageId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[^A-Za-z0-9_.\-:]&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)[:&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;indexed&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FaceRecords&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;FaceRecords&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; indexed, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;UnindexedFaces&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; dropped&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;face&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UnindexedFaces&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="n"&gt;reasons&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;face&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Reasons&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;SCRATCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# stored faces are billed until deleted
&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;indexed:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;indexed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;reasons&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;most_common&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dropped (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;): &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;500 photos cost $0.50 to index at the first-tier rate. Two limits on what this tells you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;UnindexedFaces&lt;/code&gt; only lists faces the detector found and then dropped. A face it never detected does not appear anywhere in the response.&lt;/li&gt;
&lt;li&gt;AWS documents a minimum detectable face of 40 by 40 pixels in a 1920 by 1080 image (&lt;a href="https://docs.aws.amazon.com/rekognition/latest/dg/limits.html" rel="noopener noreferrer"&gt;limits&lt;/a&gt;). In a wide group shot, the back rows are often near that size.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So finish the audit by eye. Take 20 group photos, count the faces yourself, and compare against &lt;code&gt;FaceRecords&lt;/code&gt;. The gap is faces in those photos that no search can match as they are indexed today.&lt;/p&gt;

&lt;h2&gt;
  
  
  What sellphotos.online found
&lt;/h2&gt;

&lt;p&gt;They did not switch on the strength of a pricing page. They indexed about 5,000 photos from a recent wedding into a test collection and compared search results with Rekognition's on the same photos. Then, for a day, every live guest search went to both providers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs9fgt8jqievfzslx1ucn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs9fgt8jqievfzslx1ucn.png" alt="Illustration: a single-scale pass finds the large faces at the front of a group photo and misses the smaller ones further back." width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SightRadar found more faces in group shots. Its detector scans each photo at several scales, which catches smaller faces that a single-scale pass misses. Ranking order differed slightly in a few searches, but every face Rekognition found, SightRadar found too. Within the first month the support team noticed fewer "my photos didn't show up" complaints. They did not measure it formally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F16sf1m54frzclasr9999.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F16sf1m54frzclasr9999.png" alt="Illustration: scanning at several scales finds the smaller faces in the back rows as well." width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One trade-off to plan for: finding more faces means storing more faces. Every extra face in the back row is another vector on the storage line. At these prices that is small, but put it in the estimate.&lt;/p&gt;

&lt;p&gt;The move also had costs of its own. Re-indexing the back catalogue took longer than they hoped, and they paid both providers while it ran. They spent a day re-deriving their match threshold, because Rekognition scores similarity from 0 to 100 and SightRadar from 0 to 1, and a cut-off copied from one model is wrong on another. The &lt;a href="https://sightradar.com/docs/guides/thresholds" rel="noopener noreferrer"&gt;threshold guide&lt;/a&gt; covers the method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Their bill
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzphtlii4e92lmfg2f109.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzphtlii4e92lmfg2f109.png" alt="Bar chart of the monthly face recognition bill: about $3,500 on AWS Rekognition, about $1,550 after the switch." width="800" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bill went from about $3,500 to about $1,550 a month. Those are the totals they reported, without a line-by-line breakdown. At list prices no single line is more than 40% cheaper, so the rate gap alone does not account for 56%. Treat it as their result, not a rate to plan on, and run your own numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  List prices, line by line
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Line&lt;/th&gt;
&lt;th&gt;AWS Rekognition (us-east-1, first tier)&lt;/th&gt;
&lt;th&gt;SightRadar&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Index a photo&lt;/td&gt;
&lt;td&gt;$0.0010&lt;/td&gt;
&lt;td&gt;$0.00062 batch, $0.00093 real-time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search with a selfie&lt;/td&gt;
&lt;td&gt;$0.0010&lt;/td&gt;
&lt;td&gt;$0.00093 (billed as a real-time photo)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search with a stored face id&lt;/td&gt;
&lt;td&gt;$0.0010&lt;/td&gt;
&lt;td&gt;$0.00062&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keep 1M faces for a month&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$6.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Batch indexing is 38% under Rekognition's first tier, real-time calls are 7% under, and storage is 40% under. SightRadar charges storage daily for the faces held that day. Creating and deleting collections is free.&lt;/p&gt;

&lt;p&gt;A worked example from the &lt;a href="https://sightradar.com/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;: 100,000 photos indexed in a month, 2,400 selfie searches and 300,000 stored faces.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rekognition:&lt;/strong&gt; $100.00 indexing + $2.40 search + $3.00 storage = &lt;strong&gt;$105.40&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SightRadar:&lt;/strong&gt; $62.00 batch indexing + $2.23 search + $1.80 storage = &lt;strong&gt;$66.03&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At that size storage is a rounding error. At 50 million faces it is $500 a month on Rekognition and $300 on SightRadar, charged in a month when nobody searches at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the gap narrows
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High volume.&lt;/strong&gt; Rekognition's per-image rate falls in tiers: $0.0008 after the first million Group 1 images a month, $0.0006 after 5 million, $0.0004 after 35 million. Every image past the first million costs less on Rekognition than SightRadar's real-time rate. Averaged over the month, an all-real-time workload costs less on Rekognition from about 1.5 million images, and an all-batch workload from about 37 million.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You use more than faces.&lt;/strong&gt; Labels, text detection, celebrity recognition, video and user vectors are Rekognition features SightRadar does not support. The shim raises &lt;code&gt;NotImplementedError&lt;/code&gt; for them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You are not on Python.&lt;/strong&gt; The &lt;a href="https://sightradar.com/docs/sdks/rekognition-shim" rel="noopener noreferrer"&gt;Rekognition shim&lt;/a&gt;, which let them keep their boto3 integration, is Python only. On Node or Java you map the calls to the REST API yourself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your saving depends on how much of your volume can go through batch, how many billed calls you make per photo, how many faces you keep, and how carefully you calibrate the threshold. Run the two scripts above against your own account before you decide anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The full case study: &lt;a href="https://sightradar.com/customers/sellphotos" rel="noopener noreferrer"&gt;How sellphotos.online cut their face recognition bill&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sightradar.com/pricing" rel="noopener noreferrer"&gt;SightRadar pricing and cost calculator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sightradar.com/migrate" rel="noopener noreferrer"&gt;Migrating from AWS Rekognition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sightradar.com/compare/aws-rekognition" rel="noopener noreferrer"&gt;SightRadar vs AWS Rekognition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sellphotos.online" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Disclosure again: I work on SightRadar. Prices are us-east-1 list prices at the time of writing, November 2026. Results depend on your photo mix, your volume, how many faces you keep, and how carefully you calibrate thresholds.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>finops</category>
      <category>computervision</category>
    </item>
    <item>
      <title>Moving face search off AWS Rekognition in two days: a photo marketplace's playbook</title>
      <dc:creator>Ashish Sikka</dc:creator>
      <pubDate>Fri, 06 Nov 2026 05:00:55 +0000</pubDate>
      <link>https://dev.to/ashish_sikka/moving-face-search-off-aws-rekognition-in-two-days-a-photo-marketplaces-playbook-5ele</link>
      <guid>https://dev.to/ashish_sikka/moving-face-search-off-aws-rekognition-in-two-days-a-photo-marketplaces-playbook-5ele</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article was written with AI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Disclosure: I work on SightRadar, the API this team moved to. The figures below are the ones &lt;a href="https://sellphotos.online" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt; reported. The full case study is at &lt;a href="https://sightradar.com/customers/sellphotos" rel="noopener noreferrer"&gt;sightradar.com/customers/sellphotos&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sellphotos.online" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt; is a marketplace where event and sports photographers upload their shots and guests buy the ones they appear in. A guest uploads a selfie and the platform finds every photo that person is in. They process hundreds of thousands of photos a month across weddings, marathons and corporate events.&lt;/p&gt;

&lt;p&gt;They ran this on AWS Rekognition and had two problems with it. The bill had grown to about $3,500 a month. And in crowd shots, the smaller faces in the back rows were often missed, so guests searched for themselves and came up empty. Those guests complained to the photographer, and the photographer complained to the platform.&lt;/p&gt;

&lt;p&gt;They moved face search to SightRadar in about two days. This post is the playbook they followed, with code. Most of it applies whichever provider you move to.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you are actually migrating
&lt;/h2&gt;

&lt;p&gt;A selfie-search product on Rekognition is three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A collection&lt;/strong&gt; of faces indexed from every uploaded photo (&lt;code&gt;IndexFaces&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A search&lt;/strong&gt; on every guest visit (&lt;code&gt;SearchFacesByImage&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A threshold&lt;/strong&gt; that decides what counts as a match.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first two are API calls, and they port. The third is a number tuned to one vendor's model, and it does not. Most bad migrations go wrong at the threshold, not at the API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: test on one real event
&lt;/h2&gt;

&lt;p&gt;They set up a test collection, indexed about 5,000 photos from a recent wedding, and compared search results against what Rekognition returned for the same photos.&lt;/p&gt;

&lt;p&gt;Pick an event with the hard cases in it: group shots, people far from the camera, bad light. Every provider handles a well-lit portrait, so clean photos tell you nothing.&lt;/p&gt;

&lt;p&gt;Their backend is mostly Python, so they used the &lt;a href="https://sightradar.com/docs/sdks/rekognition-shim" rel="noopener noreferrer"&gt;Rekognition shim&lt;/a&gt;. It keeps boto3's method names, arguments and response shapes, so the change is the import and the constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sightradar_rekognition_shim&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;   &lt;span class="c1"&gt;# was: import boto3
&lt;/span&gt;
&lt;span class="n"&gt;rek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;frs_...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                    &lt;span class="c1"&gt;# was: boto3.client("rekognition")
&lt;/span&gt;
&lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;test-wedding&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;index_faces&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;test-wedding&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;URL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://cdn.example.com/wedding/0001.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;ExternalImageId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0001&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things to know before you start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The shim maps &lt;code&gt;Image={"S3Object": ...}&lt;/code&gt; to a public S3 URL, which has to be fetchable. A private bucket needs a URL the API can fetch, such as a presigned one passed as &lt;code&gt;{"URL": ...}&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The shim is Python only (&lt;a href="https://pypi.org/project/sightradar-rekognition-shim/" rel="noopener noreferrer"&gt;PyPI&lt;/a&gt;). On Node or Java you map the calls to the REST API yourself, which is more work than swapping an import.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: batch re-index the back catalogue
&lt;/h2&gt;

&lt;p&gt;This was the biggest chunk of work: hundreds of thousands of existing photos. Indexing them one synchronous call at a time is slow at that volume. Instead they used the batch endpoint, which takes up to 1,000 photo URLs per call and delivers one webhook per photo as results land. They scripted the submissions and let it run overnight.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;BASE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.sightradar.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;HEADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Authorization&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Bearer &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;SIGHTRADAR_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collection_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;photos&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;webhook_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;photos: up to 1,000 dicts of {&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;url&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;: ..., &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;external_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;: ...}&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BASE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/v1/batches&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;collection_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;collection_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;op&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;index&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;webhook_endpoint_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;webhook_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;photos&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;photos&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;batch_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# all_photos: your catalogue as {"url", "external_id"} dicts; WEBHOOK_ID from POST /v1/webhooks
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;all_photos&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;events&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;all_photos&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;WEBHOOK_ID&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each webhook carries your &lt;code&gt;external_id&lt;/code&gt;, a &lt;code&gt;status&lt;/code&gt;, and on failure an &lt;code&gt;error.code&lt;/code&gt; such as &lt;code&gt;image_fetch_failed&lt;/code&gt;. Failed photos are not charged. Keep a list of them and resubmit once you have fixed the cause. The &lt;a href="https://sightradar.com/docs/guides/batch-and-webhooks" rel="noopener noreferrer"&gt;batch guide&lt;/a&gt; covers registering the endpoint and verifying signatures.&lt;/p&gt;

&lt;p&gt;Plan for this step to take longer than you expect. It did for them. While it runs you are paying both providers, because live uploads still go to the old one. That double cost is short, but put it in the budget.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: run both providers side by side
&lt;/h2&gt;

&lt;p&gt;For the next day, every guest search went to both providers and they compared the ranked results. The shim returns Rekognition-shaped responses, so the comparison is short:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sightradar_rekognition_shim&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;

&lt;span class="n"&gt;aws&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rekognition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us-east-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;sr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# reads SIGHTRADAR_API_KEY
&lt;/span&gt;
&lt;span class="c1"&gt;# Start loose on both sides: you are comparing what each provider finds,
# not deciding matches yet. That is step 4.
&lt;/span&gt;&lt;span class="n"&gt;AWS_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;
&lt;span class="n"&gt;SR_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;  &lt;span class="c1"&gt;# the shim divides by 100, so this is 0.5 cosine
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;photo_ids&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;threshold&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selfie&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rek&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_faces_by_image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;CollectionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;events&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Bytes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;selfie&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="n"&gt;FaceMatchThreshold&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;threshold&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;MaxFaces&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Face&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ExternalImageId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FaceMatches&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;

&lt;span class="n"&gt;selfie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;guest.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;photo_ids&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;aws&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AWS_THRESHOLD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selfie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;photo_ids&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SR_THRESHOLD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selfie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;both: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;  only AWS: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;  only SightRadar: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at the "only" sets by eye. They tell you more than any aggregate number.&lt;/p&gt;

&lt;p&gt;In their case, SightRadar found more faces in group shots. Its detector scans each photo at several scales, which catches smaller faces that a single-scale pass misses. The ranking order differed slightly in a few searches, but every face Rekognition found, SightRadar found too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs9fgt8jqievfzslx1ucn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs9fgt8jqievfzslx1ucn.png" alt="Illustration: a single-scale pass finds the large faces at the front of a group photo and misses the smaller ones further back." width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F16sf1m54frzclasr9999.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F16sf1m54frzclasr9999.png" alt="Illustration: scanning at several scales finds the smaller faces in the back rows as well." width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: re-derive the threshold
&lt;/h2&gt;

&lt;p&gt;This is the step people skip, and then they blame the new provider when results look off.&lt;/p&gt;

&lt;p&gt;Rekognition scores similarity from 0 to 100. SightRadar returns cosine similarity from 0 to 1. The shim converts the scale both ways, but converting the scale does not convert the decision. Two models put the same "same person" call at different scores, so a cut-off copied from Rekognition is wrong on the new model.&lt;/p&gt;

&lt;p&gt;They spent a day on this with known match and non-match pairs from their test events. The method is short:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Collect a few hundred same-person pairs and a few hundred different-person pairs from your own photos: same cameras, same venues, same lighting.&lt;/li&gt;
&lt;li&gt;Score every pair.&lt;/li&gt;
&lt;li&gt;Pick your cut-offs from the scores: accept above nearly all of the different-person scores, and review the band below that where most real matches still sit.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url_a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url_b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BASE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/v1/compare&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                      &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sourceUrl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;url_a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;targetUrl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;url_b&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;similarity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;face_found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="c1"&gt;# same_person_pairs / different_person_pairs: lists of (url_a, url_b) you labelled by hand
&lt;/span&gt;&lt;span class="n"&gt;same&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;same_person_pairs&lt;/span&gt; &lt;span class="nf"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;different_person_pairs&lt;/span&gt; &lt;span class="nf"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Accept automatically above the score that lets through at most ~1% of
# different-person pairs. Below that, down to where 95% of real matches sit,
# ask the guest "Is this you?" instead of hiding the photo.
&lt;/span&gt;&lt;span class="n"&gt;accept&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.99&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="n"&gt;review&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;same&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;same&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;accept &amp;gt;= &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;; review band &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; to &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each compare is billed as two photos ($0.00186 a pair), so 600 pairs costs about $1.12. Two bands usually beat a single cut-off for photo discovery, because a wrong suggestion is cheap when the guest confirms it. The &lt;a href="https://sightradar.com/docs/guides/thresholds" rel="noopener noreferrer"&gt;threshold guide&lt;/a&gt; goes further on picking bands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: cut over
&lt;/h2&gt;

&lt;p&gt;By now every existing photo was indexed in both systems, so the cutover was a config change: new index calls and searches went to SightRadar. If you can afford it, keep the old collection for a while so rolling back is also just a config change.&lt;/p&gt;

&lt;h2&gt;
  
  
  What they reported afterwards
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The bill went from about $3,500 to about $1,550 a month&lt;/strong&gt;, for the same photos and the same number of searches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fewer "my photos didn't show up" tickets&lt;/strong&gt; within the first month. They didn't track it formally; the support team noticed fewer of those complaints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clearer visibility&lt;/strong&gt; into costs: per-operation spend, search results and collection sizes in one console, instead of CloudWatch metrics and Cost Explorer tags.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzphtlii4e92lmfg2f109.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzphtlii4e92lmfg2f109.png" alt="Bar chart of the monthly face recognition bill: about $3,500 on AWS Rekognition, about $1,550 after the switch." width="800" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For context on those numbers, here are the list prices. Rekognition's first US tier is $0.0010 per image. SightRadar's batch rate is $0.00062 per photo, 38% lower, and its real-time rate is $0.00093, 7% lower. Your saving depends mostly on how much of your volume can go through batch and on how many calls you make per photo. Run your own numbers with the &lt;a href="https://sightradar.com/pricing" rel="noopener noreferrer"&gt;pricing calculator&lt;/a&gt; before you decide anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  When this is not a like-for-like swap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You use more than faces.&lt;/strong&gt; Labels, text detection, celebrity recognition, video and user vectors are not supported. The shim raises &lt;code&gt;NotImplementedError&lt;/code&gt; for them instead of silently doing nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You are on very high volume.&lt;/strong&gt; Rekognition's per-image rate drops to $0.0008 after the first million images a month and lower after that. At that scale the gap narrows, and for real-time calls it can flip.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You are not on Python.&lt;/strong&gt; There is no shim for other AWS SDKs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You rely on final deletes.&lt;/strong&gt; Deleting a collection is a restorable soft delete by default. Pass &lt;code&gt;Immediate=True&lt;/code&gt; through the shim if you need Rekognition's finality.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The full case study: &lt;a href="https://sightradar.com/customers/sellphotos" rel="noopener noreferrer"&gt;How sellphotos.online cut their face recognition bill&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sightradar.com/migrate" rel="noopener noreferrer"&gt;Migrating from AWS Rekognition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sightradar.com/docs/sdks/rekognition-shim" rel="noopener noreferrer"&gt;Rekognition shim reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sightradar.com/docs/guides/thresholds" rel="noopener noreferrer"&gt;Choosing a similarity threshold&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sellphotos.online" rel="noopener noreferrer"&gt;sellphotos.online&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Disclosure again: I work on SightRadar. Results depend on your photo mix, your volume, and how carefully you calibrate thresholds.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>computervision</category>
    </item>
  </channel>
</rss>
