<?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: Rahul Kumar Verma</title>
    <description>The latest articles on DEV Community by Rahul Kumar Verma (@rahul_kumarverma_805999a).</description>
    <link>https://dev.to/rahul_kumarverma_805999a</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%2F4213100%2Fe621350d-b379-491b-8b06-89f4f1a0cac8.jpg</url>
      <title>DEV Community: Rahul Kumar Verma</title>
      <link>https://dev.to/rahul_kumarverma_805999a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahul_kumarverma_805999a"/>
    <language>en</language>
    <item>
      <title>How I Built a 100% Client-Side Image Compressor for Indian Government Exams Using HTML5 Canvas &amp; Astro</title>
      <dc:creator>Rahul Kumar Verma</dc:creator>
      <pubDate>Wed, 28 Oct 2026 12:49:37 +0000</pubDate>
      <link>https://dev.to/rahul_kumarverma_805999a/how-i-built-a-100-client-side-image-compressor-for-indian-government-exams-using-html5-canvas--3d9b</link>
      <guid>https://dev.to/rahul_kumarverma_805999a/how-i-built-a-100-client-side-image-compressor-for-indian-government-exams-using-html5-canvas--3d9b</guid>
      <description>&lt;p&gt;Applying for competitive exams in India (like SSC, UPSC, IBPS, and State PSCs) comes with a surprisingly frustrating bottleneck: strict, archaic image upload rules. &lt;/p&gt;

&lt;p&gt;One portal asks for a passport photo between &lt;code&gt;20KB and 50KB&lt;/code&gt; with a specific pixel aspect ratio and a printed date of birth. Another demands a signature compressed strictly between &lt;code&gt;10KB and 20KB&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Most students end up uploading their personal photos and signatures to ad-heavy online resizers that process files on remote servers—creating an unnecessary privacy risk.&lt;/p&gt;

&lt;p&gt;To solve this with zero server costs and 100% privacy, I built &lt;strong&gt;&lt;a href="https://sarkariphototool.com" rel="noopener noreferrer"&gt;Sarkari Photo Tool&lt;/a&gt;&lt;/strong&gt;, a fully client-side image resizer and compressor built with &lt;strong&gt;Astro, Tailwind CSS, and Vanilla TypeScript&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How the Client-Side KB Targeting Works
&lt;/h3&gt;

&lt;p&gt;Instead of sending images to a backend (like Sharp or ImageMagick), the entire compression pipeline runs inside the user's browser using the native &lt;code&gt;HTMLCanvasElement.toBlob()&lt;/code&gt; API:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Aspect Ratio &amp;amp; Pixel Mapping:&lt;/strong&gt; When a user selects an exam preset (for example, the &lt;a href="https://sarkariphototool.com/ssc-gd" rel="noopener noreferrer"&gt;SSC GD Photo &amp;amp; Signature Resizer&lt;/a&gt; or &lt;a href="https://sarkariphototool.com/upsc-cse" rel="noopener noreferrer"&gt;UPSC CSE Photo Resizer&lt;/a&gt;), the canvas automatically locks into the exact official dimensions (e.g., &lt;code&gt;3.5cm x 4.5cm&lt;/code&gt; or &lt;code&gt;350x350 px&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Date &amp;amp; Name Stamping:&lt;/strong&gt; If the exam notification requires a printed name and date at the bottom of the photograph, the Canvas 2D context draws a clean white bar and renders the text dynamically before compression.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterative Binary Search Compression:&lt;/strong&gt; Since &lt;code&gt;canvas.toBlob(callback, 'image/jpeg', quality)&lt;/code&gt; doesn't let you specify a target file size in kilobytes directly, the script runs a fast binary search over the &lt;code&gt;quality&lt;/code&gt; parameter (&lt;code&gt;0.1&lt;/code&gt; to &lt;code&gt;0.95&lt;/code&gt;) until the resulting Blob size lands squarely within the required KB range (e.g., &lt;code&gt;20KB–50KB&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why Static + Programmatic SEO?
&lt;/h3&gt;

&lt;p&gt;By combining &lt;strong&gt;Astro's static site generation&lt;/strong&gt; with a centralized JSON specification database, every exam gets its own dedicated, ultra-fast route with zero runtime server overhead on Cloudflare Pages.&lt;/p&gt;

&lt;p&gt;I also open-sourced the exam specification dataset here on GitHub: &lt;strong&gt;&lt;a href="https://github.com/Rahulj02195/indian-govt-exam-photo-signature-specs" rel="noopener noreferrer"&gt;indian-govt-exam-photo-signature-specs&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you are building micro-utilities, shifting heavy media processing to the client browser is the easiest way to keep hosting 100% free while giving users instant results!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>javascript</category>
      <category>astro</category>
    </item>
  </channel>
</rss>
