ToolFreely brings privacy‑first, client‑side KB‑range compression for exam photos and PDFs

ToolFreely · File Compression: ToolFreely compresses exam photos and PDFs client-side without uploading files.

ToolFreely enables Indian job‑seeker and exam applicants to compress photos, signatures and scanned PDFs to the exact kilobyte windows demanded by portals such as SBI, UPSC and SSC, all while keeping the file on the user’s device.

Architecture and lazy loading

The site is built as a static Astro project; each compression page mounts a React island only when the user opens it. Heavy libraries—pdf.js, pdf‑lib and a HEIC decoder—are fetched on demand, so a user who only resizes a JPEG avoids downloading a megabyte of extra code.

The same front‑end approach is described on the ToolFreely product page, which emphasizes the no‑install, no‑upload promise and the 25 MB input cap that prevents the browser from freezing on large files.

Resolving ambiguous kilobyte definitions

Indian portals sometimes count 1 KB as 1 000 bytes and other times as 1 024 bytes. ToolFreely therefore computes a minimum byte count using the larger 1 024‑based conversion and a maximum using the smaller 1 000‑based conversion, then checks that the file size falls between them. The UI displays the size in both conventions so users can verify against the portal’s wording.

The public preset table on the ToolFreely site repeats this rule, stating that each generated file is kept inside both interpretations.

Binary‑search quality for a size window

Rather than lowering quality until a single ceiling is reached, the tool performs a binary search on JPEG quality to land in the middle of the allowed range (e.g., 20–50 KB). The loop runs up to eight iterations or stops when the file is within 4 % of the target, guaranteeing a fast, bounded computation on a phone.

If even the lowest quality still exceeds the maximum, the algorithm scales the image dimensions down using a factor derived from the ratio of target to current bytes, with a hard floor of 15 % of the original size, then repeats the search.

Minimum‑size padding and PDF handling

When a portal enforces a lower bound (e.g., at least 10 KB), ToolFreely pads the JPEG by inserting a COM (comment) segment just before the end‑of‑image marker. Decoders ignore the comment, so the visual content stays unchanged while the byte count rises to meet the floor.

For scanned PDFs the tool renders each page to a canvas via pdf.js, optionally converts to grayscale, then re‑encodes pages as JPEGs using a fixed ladder of scale‑quality pairs. The first combination that fits the byte budget is used to rebuild the document with pdf‑lib. If no combination fits within the 30 MB total or 20‑page limit, the tool aborts with an error rather than producing an unreadable file.

The ToolFreely website lists the same PDF‑compress workflow and the hard limits on page count and total size, reinforcing the design described in the dev.to post.

Privacy verification and network footprint

A CSP alone does not guarantee privacy, so the author audited the page in a headless browser. The only outbound request after a file is selected is a first‑party analytics beacon; the file never leaves the user’s tab. Advertisements on the site are served from the same domain, preserving the “no upload” claim.

Why browser‑side KB‑range compression matters

For developers building form‑submission portals, ToolFreely shows that strict file‑size windows can be satisfied without a back‑end compressor, reducing server load and removing a privacy risk where personal identification images travel to third‑party services. The binary‑search quality algorithm is lightweight enough to run on mid‑range phones, making it a reusable pattern for any client‑side media optimization task that must obey both upper and lower size constraints. The explicit handling of ambiguous kilobyte definitions and the comment‑segment padding also provide concrete solutions to edge cases that frequently trip up legacy compressors. By publishing the source logic and preset data, the project invites integration into other open‑source form tools, potentially standardising a privacy‑first approach across Indian exam portals and any regulated environment where users must meet exact upload specifications.

Editorial graphic and headline text by Signal Titans.

Source: Hitting an exact KB range in the browser: how we compress exam photos and PDFs without a server · Compress or Resize Image to 50KB, No Upload | ToolFreely

Share this article
FacebookThreadsLinkedInX

Leave a Reply

Your email address will not be published. Required fields are marked *