<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[toolsdzire]]></title><description><![CDATA[toolsdzire]]></description><link>https://toolsdzire.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 14:05:15 GMT</lastBuildDate><atom:link href="https://toolsdzire.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[JPG to PDF in the browser]]></title><description><![CDATA[js Sizing each page to its image keeps the original proportions. If you want standard A4 pages, scale the image to fit inside 595 x 842 points and center…]]></description><link>https://toolsdzire.hashnode.dev/jpg-to-pdf-in-the-browser</link><guid isPermaLink="true">https://toolsdzire.hashnode.dev/jpg-to-pdf-in-the-browser</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[pdf]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[RAHUL KUMAR]]></dc:creator><pubDate>Sat, 14 Nov 2026 17:17:02 GMT</pubDate><content:encoded><![CDATA[<p>js</p>
<pre><code class="language-js">import { PDFDocument } from "pdf-lib";

async function imagesToPdf(files) {
  const pdf = await PDFDocument.create();
  for (const file of files) {
    const bytes = await file.arrayBuffer();
    const img = file.type === "image/png"
      ? await pdf.embedPng(bytes)
      : await pdf.embedJpg(bytes);
    const page = pdf.addPage([img.width, img.height]);
    page.drawImage(img, { x: 0, y: 0, width: img.width, height: img.height });
  }
  return pdf.save();
}
</code></pre>
<p>Sizing each page to its image keeps the original proportions. If you want standard A4 pages, scale the image to fit inside 595 x 842 points and center it. Phone photos can be 5-10 MB each, so resize them first or the PDF becomes too large for upload portals. WebP and HEIC are not supported by <code>embedJpg</code>/<code>embedPng</code>; convert them through a canvas first.</p>
<p>Free tool: <a href="https://toolsdzire.com/jpg-to-pdf">https://toolsdzire.com/jpg-to-pdf</a></p>
]]></content:encoded></item><item><title><![CDATA[Compress an image to an exact size (like 100 KB) with binary search]]></title><description><![CDATA[Online forms often demand “under 100 KB”. Instead of guessing a quality value, binary-search it.]]></description><link>https://toolsdzire.hashnode.dev/compress-an-image-to-an-exact-size-like-100-kb-with-binary-search</link><guid isPermaLink="true">https://toolsdzire.hashnode.dev/compress-an-image-to-an-exact-size-like-100-kb-with-binary-search</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[algorithms]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[RAHUL KUMAR]]></dc:creator><pubDate>Sat, 14 Nov 2026 17:15:03 GMT</pubDate><content:encoded><![CDATA[<p>Online forms often demand “under 100 KB”. Instead of guessing a quality value, binary-search it.</p>
<p>js</p>
<pre><code class="language-js">async function compressToTarget(canvas, maxBytes) {
  const toBlob = (q) =&gt;
    new Promise((r) =&gt; canvas.toBlob(r, "image/jpeg", q));
  let lo = 0.1, hi = 0.95, best = null;
  for (let i = 0; i &lt; 7; i++) {
    const mid = (lo + hi) / 2;
    const blob = await toBlob(mid);
    if (blob.size &lt;= maxBytes) { best = blob; lo = mid; }
    else hi = mid;
  }
  return best; // null means: shrink dimensions and retry
}
</code></pre>
<p>Seven iterations is enough to land close to the limit. If <code>best</code> is null, even the lowest quality was too big, so reduce the canvas size by 10-20% and run again. Always show the user the final size and a preview, because very low quality can blur faces and signatures.</p>
<p>Step-by-step version for non-developers: <a href="https://toolsdzire.com/blog/reduce-image-size-to-100kb">https://toolsdzire.com/blog/reduce-image-size-to-100kb</a></p>
]]></content:encoded></item><item><title><![CDATA[Resizing images in the browser without ugly results]]></title><description><![CDATA[Before compressing, resize. Dimensions affect file size more than quality does.]]></description><link>https://toolsdzire.hashnode.dev/resizing-images-in-the-browser-without-ugly-results</link><guid isPermaLink="true">https://toolsdzire.hashnode.dev/resizing-images-in-the-browser-without-ugly-results</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[canvas]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[RAHUL KUMAR]]></dc:creator><pubDate>Sat, 14 Nov 2026 17:13:04 GMT</pubDate><content:encoded><![CDATA[<p>Before compressing, resize. Dimensions affect file size more than quality does.</p>
<p>js</p>
<pre><code class="language-js">async function resize(file, maxSide) {
  const bmp = await createImageBitmap(file);
  const scale = Math.min(1, maxSide / Math.max(bmp.width, bmp.height));
  const canvas = document.createElement("canvas");
  canvas.width = Math.round(bmp.width * scale);
  canvas.height = Math.round(bmp.height * scale);
  const ctx = canvas.getContext("2d");
  ctx.imageSmoothingQuality = "high";
  ctx.drawImage(bmp, 0, 0, canvas.width, canvas.height);
  return canvas;
}
</code></pre>
<p>Tips: never upscale (<code>Math.min(1, ...)</code>), keep the aspect ratio, and set <code>imageSmoothingQuality = "high"</code>. For big reductions, downscale in two steps instead of one to avoid jagged edges. PNGs with transparency turn black when exported as JPEG, so fill the canvas white first.</p>
<p>Free resizer built this way: <a href="https://toolsdzire.com/image-tools">https://toolsdzire.com/image-tools</a></p>
]]></content:encoded></item><item><title><![CDATA[Merge PDFs in the browser with pdf-lib]]></title><description><![CDATA[Most online PDF mergers upload your files to a server. You can do it entirely client-side with pdf-lib, so private documents never leave the device.]]></description><link>https://toolsdzire.hashnode.dev/merge-pdfs-in-the-browser-with-pdf-lib</link><guid isPermaLink="true">https://toolsdzire.hashnode.dev/merge-pdfs-in-the-browser-with-pdf-lib</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev, pdf]]></category><dc:creator><![CDATA[RAHUL KUMAR]]></dc:creator><pubDate>Sat, 14 Nov 2026 17:10:49 GMT</pubDate><content:encoded><![CDATA[<p>Most online PDF mergers upload your files to a server. You can do it entirely client-side with <code>pdf-lib</code>, so private documents never leave the device.</p>
<p>js</p>
<pre><code class="language-js">import { PDFDocument } from "pdf-lib";

async function mergePdfs(files) {
  const merged = await PDFDocument.create();
  for (const file of files) {
    const src = await PDFDocument.load(await file.arrayBuffer());
    const pages = await merged.copyPages(src, src.getPageIndices());
    pages.forEach((p) =&gt; merged.addPage(p));
  }
  return merged.save(); // Uint8Array
}

// download
const bytes = await mergePdfs([...input.files]);
const url = URL.createObjectURL(new Blob([bytes], { type: "application/pdf" }));
</code></pre>
<p>Things I learned: encrypted PDFs fail to load (ask the user to unlock first), and very large files can freeze the main thread, so run the work in a Web Worker. Order of the <code>files</code> array is the order of the output, so let users drag to reorder before merging.</p>
<p>I use this approach in a free tool here: <a href="https://toolsdzire.com/merge-pdf">https://toolsdzire.com/merge-pdf</a></p>
]]></content:encoded></item></channel></rss>