<?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: Quy Ngoc</title>
    <description>The latest articles on DEV Community by Quy Ngoc (@vothuong).</description>
    <link>https://dev.to/vothuong</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%2F4279504%2F2575bf14-1156-4279-8401-5e486cdeedab.jpg</url>
      <title>DEV Community: Quy Ngoc</title>
      <link>https://dev.to/vothuong</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vothuong"/>
    <language>en</language>
    <item>
      <title>Building an in-place image translator that runs in the browser</title>
      <dc:creator>Quy Ngoc</dc:creator>
      <pubDate>Fri, 04 Dec 2026 02:15:00 +0000</pubDate>
      <link>https://dev.to/vothuong/building-an-in-place-image-translator-that-runs-in-the-browser-5c3f</link>
      <guid>https://dev.to/vothuong/building-an-in-place-image-translator-that-runs-in-the-browser-5c3f</guid>
      <description>&lt;p&gt;Google Lens-style "translate what's in the photo and keep the layout" is a genuinely fun problem. Here's the shape of a version that does the heavy lifting on the client and only calls a model for the part a model is actually good at.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Vision model → structured blocks.&lt;/strong&gt; Send the image to a multimodal model and ask for strict JSON: for each text block, a bounding box normalized to 0–1000, the original text, the translation, the glyph color, and a bold flag. Keeping the model's job narrow (read + translate + locate) makes the output much more reliable than asking it to "edit the image."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Snap the boxes to the real ink.&lt;/strong&gt; Model boxes are approximate — they drift by half a line. On the client, take the box as a hint, find the dominant background color inside it, build an ink mask, and discard any ink touching the search border (that's a banner edge or a neighbouring line). What's left, enclosed by background, is the true text extent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Erase the original text.&lt;/strong&gt; For flat or gradient backgrounds, a Coons-patch fill interpolated from the four edges is seamless and instant. For busy photo backgrounds, an inpainting model (MI-GAN) fed a mask of only the glyph pixels — dilated to catch the anti-aliasing and shadow — removes the text without smudging.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redraw the translation.&lt;/strong&gt; Match the measured color, infer the original font size by comparing the source text's rendered ink-height to its height on the image, auto-fit, and re-wrap.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The gotcha worth knowing
&lt;/h2&gt;

&lt;p&gt;Running ONNX inference on the main thread &lt;strong&gt;freezes the whole tab&lt;/strong&gt; for the duration — I measured a ~15 second lock on background inpainting. Setting &lt;code&gt;ort.env.wasm.proxy = true&lt;/code&gt; silently fell back to the main thread in a Vite/ESM build. The fix that actually worked was a dedicated Web Worker that imports onnxruntime-web, caches models in Cache Storage, and transfers buffers both ways. Main-thread freeze dropped from ~15s to ~0.5s.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;A free, no-sign-up version is live at &lt;strong&gt;&lt;a href="https://roodytools.com/translate-image" rel="noopener noreferrer"&gt;roodytools.com/translate-image&lt;/a&gt;&lt;/strong&gt; — drop in a screenshot or a photo of a menu/sign and it replaces the text in place, then lets you zoom in to inspect and tap any block to fix the wording.&lt;/p&gt;

&lt;p&gt;More browser-only tools at &lt;a href="https://roodytools.com" rel="noopener noreferrer"&gt;roodytools.com&lt;/a&gt;. Questions welcome.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>ai</category>
      <category>canvas</category>
    </item>
    <item>
      <title>Upscaling images in the browser — no server, no upload, no cost</title>
      <dc:creator>Quy Ngoc</dc:creator>
      <pubDate>Thu, 03 Dec 2026 14:52:56 +0000</pubDate>
      <link>https://dev.to/vothuong/upscaling-images-in-the-browser-no-server-no-upload-no-cost-hin</link>
      <guid>https://dev.to/vothuong/upscaling-images-in-the-browser-no-server-no-upload-no-cost-hin</guid>
      <description>&lt;p&gt;Most "AI upscaler" sites do the same thing: you upload your picture, their GPU runs a super-resolution model, and you download the result (often behind a sign-up, a watermark, or a credit limit). That round trip is slow and it means your image lives on someone else's server for a while.&lt;/p&gt;

&lt;p&gt;You don't actually need the server. Modern browsers can run the whole pipeline locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two halves of a good upscaler
&lt;/h2&gt;

&lt;p&gt;Upscaling is rarely one step. What works well in practice is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Progressive resampling.&lt;/strong&gt; Jumping straight from 1x to 4x with a single &lt;code&gt;drawImage&lt;/code&gt; looks mushy. Doubling in stages (1x → 2x → 4x) with high-quality smoothing between each step keeps edges far cleaner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A light sharpening pass.&lt;/strong&gt; After the resize, an unsharp mask restores the micro-contrast that interpolation softens. The trick is doing it per-channel and yielding to the event loop between channels so the tab never freezes on a big image.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For photos, a small super-resolution model on top of that gives the "AI" jump in detail; for screenshots and line art, the resample-plus-sharpen path alone is often enough and much faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why client-side is the right call
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Privacy:&lt;/strong&gt; the pixels never leave the device. For personal photos, IDs, or unreleased product shots that matters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; there's no per-image GPU bill, which is exactly why it can be free with no watermark.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline-ish:&lt;/strong&gt; after the first load it works without a network round trip per image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The one real hazard is memory. A user who asks for 8x on a 4000px photo is requesting a canvas with hundreds of millions of pixels, which will OOM the tab. The fix is to clamp the output to a sane maximum (both a max dimension and a max megapixel count) and pre-shrink the source so the final buffer stays within budget. Cheap insurance against a crash.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;I put a free, client-side version online here: &lt;strong&gt;&lt;a href="https://roodytools.com/image-upscaler" rel="noopener noreferrer"&gt;roodytools.com/image-upscaler&lt;/a&gt;&lt;/strong&gt;. No upload, no account, no watermark, unlimited. Drop an image in and it enlarges it right in the tab.&lt;/p&gt;

&lt;p&gt;It's part of a small set of browser-only image/PDF tools at &lt;a href="https://roodytools.com" rel="noopener noreferrer"&gt;roodytools.com&lt;/a&gt; — all built on the same "do the work locally" idea. Happy to answer questions about the implementation in the comments.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>machinelearning</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Building a 100% client-side AI signature generator (no backend, no uploads)</title>
      <dc:creator>Quy Ngoc</dc:creator>
      <pubDate>Thu, 03 Dec 2026 02:47:03 +0000</pubDate>
      <link>https://dev.to/vothuong/building-a-100-client-side-ai-signature-generator-no-backend-no-uploads-2enc</link>
      <guid>https://dev.to/vothuong/building-a-100-client-side-ai-signature-generator-no-backend-no-uploads-2enc</guid>
      <description>&lt;p&gt;Most "signature generator" sites either slap a cursive &lt;strong&gt;font&lt;/strong&gt; on your name, or upload your image to a server. I wanted neither: real pen strokes, and nothing ever leaving the browser. Here is how I built one that runs entirely client-side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fonts don't look like signatures
&lt;/h2&gt;

&lt;p&gt;A font repeats the same glyph every time — a dead giveaway. Real signatures are &lt;strong&gt;one or two continuous strokes&lt;/strong&gt; with variable-width ink, connected letters, and a flourished initial and tail. So instead of a font I used a small &lt;strong&gt;recurrent neural network&lt;/strong&gt; (Alex Graves' handwriting-synthesis model) that outputs pen &lt;em&gt;offsets&lt;/em&gt; &lt;code&gt;(dx, dy, pen-up)&lt;/code&gt; step by step.&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;offsets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;bias&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;seed&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;offsetsToLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;offsets&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// -&amp;gt; strokes of [x, y] points&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;bias&lt;/code&gt; controls neatness, &lt;code&gt;style&lt;/code&gt; picks one of ~80 handwriting styles, and &lt;code&gt;seed&lt;/code&gt; makes a result reproducible. About 2.6 MB of weights load once into the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making it read as a &lt;em&gt;signature&lt;/em&gt;, not handwriting
&lt;/h2&gt;

&lt;p&gt;Raw model output looks like neat handwriting, not a signature. Three passes fix that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Connect&lt;/strong&gt; the separate letters into one stroke with curved Bézier ligatures that follow the pen's exit/entry tangents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flourish&lt;/strong&gt; the first letter (a lead-in swash) and the last (a trailing tail) from a small library of parametric swash shapes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vary&lt;/strong&gt; each sample (slant, width, baseline wave) so a gallery of styles actually diverges instead of looking identical.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Everything renders to &lt;strong&gt;vector SVG&lt;/strong&gt;, so export is a transparent-background SVG or PNG — no server round-trip.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why client-side is the real win
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Privacy&lt;/strong&gt; — your name and signature never touch a server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; — the site is static assets on Cloudflare, so N users cost $0 extra: the ~0.35s of inference per signature runs on &lt;em&gt;their&lt;/em&gt; device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No limits&lt;/strong&gt; — no rate limiting needed when you are not paying per request.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Gotchas
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The model is Latin-only, so I strip diacritics (&lt;code&gt;Nguyễn → Nguyen&lt;/code&gt;) before inference.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;model.write&lt;/code&gt; can run long on weak phones, so I paint the gallery &lt;strong&gt;tile by tile&lt;/strong&gt; — the first result shows in ~0.3s instead of waiting for all 10.&lt;/li&gt;
&lt;li&gt;SVG can't vary stroke width along one path, so each stroke is split into constant-width runs bucketed by pen speed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can try the finished tool for free (no signup, no watermark): &lt;strong&gt;&lt;a href="https://roodytools.com/signature-generator" rel="noopener noreferrer"&gt;RoodyTools AI Signature Generator&lt;/a&gt;&lt;/strong&gt;. There is also a draw-and-practice pad and a bunch of other &lt;a href="https://roodytools.com" rel="noopener noreferrer"&gt;free client-side tools&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy to answer anything about the stroke model or the client-side setup in the comments.&lt;/p&gt;

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