How to measure compressed svg sizes in bulk with the jad api
- Step 1Query the estimation endpoint — GET /api/svg/compression-estimate?file=icon.svg or POST the SVG body. The response JSON includes: raw_bytes, gzip_bytes, brotli_bytes, gzip_ratio, brotli_ratio.
- Step 2Add a size budget check — In your CI script: if brotli_bytes > 10240, fail the build with a message. This enforces a 10 KB brotli budget per icon, preventing accidental bloat from reaching production.
- Step 3Dashboard your size trends — Store the API response data per build in your analytics database. Plot SVG total transfer size over time to catch regressions early.
Frequently asked questions
What does the API return?+
A JSON object with: raw_bytes (uncompressed), gzip_bytes (deflate-raw compression), brotli_bytes (if available), gzip_ratio (percentage), brotli_ratio (percentage), and filename.
Can I estimate compression for inline SVG in HTML?+
Pass the HTML string (with SVG inlined) to the estimation endpoint. It processes any text content and estimates both algorithms regardless of the file's content structure.
What plan is required for API access?+
The Compression Estimation API is available on the Developer plan. The browser UI version is free — no account required.
Can I integrate this with size-limit or bundlesize?+
Yes. Both size-limit and bundlesize accept custom size functions. Write a plugin that calls the JAD API to get brotli sizes and feeds them into the size-limit threshold check.
Privacy first
Every JAD SVG tool runs entirely in your browser using the DOM API and Canvas. Your SVG files never leave your device — verified by zero outbound network requests during processing.