How to batch low poly background generation with api and scripts
- Step 1Design the generation parameters — Fix the triangle count (e.g., 300) and bounding dimensions (1440×900) for consistency across the library. Vary only the colour palette and the point distribution seed. This creates a family of backgrounds that are clearly related but each unique.
- Step 2Generate at scale via API — POST to the /polygon/batch endpoint with seeds 1–100 and your fixed parameters. The API generates 100 unique low-poly SVGs and returns them as an array of SVG strings or a ZIP file of individual files.
- Step 3Cache and serve — Upload the generated SVGs to your CDN under predictable URLs: /backgrounds/low-poly-{seed}.svg. Assign seeds to users, products, or pages consistently (e.g., using userId % 100). The URL is deterministic — the same user always gets the same background.
Frequently asked questions
How do I generate a low-poly avatar background from a user ID?+
Hash the user ID to get a seed: seed = parseInt(md5(userId), 16) % 10000. POST to the /polygon/batch API with this seed and a default colour palette. Cache the result at /avatars/bg-{seed}.svg. The same user always gets the same background without storing anything in a database.
Can I generate low-poly backgrounds from user-selected colours?+
Yes. The API accepts a palette array of hex colour strings. Generate 3–5 variations from the user's chosen colours by varying the seed. Present the variations and let the user pick their preferred one. Store only the chosen seed and the colour palette — never the SVG itself, which can be regenerated on demand.
What is the latency for on-demand low-poly generation?+
The API generates a 300-triangle SVG in approximately 50–100ms. A 1000-triangle SVG takes 200–400ms. For user-facing on-demand generation, cache the result aggressively — the same seed + palette always produces the same SVG. Serve from CDN with a content hash URL for instant repeat loads.
Can I generate low-poly backgrounds server-side without the API?+
Yes. Use the Delaunay.js or d3-delaunay npm package to run Delaunay triangulation in Node.js. The algorithm is pure JavaScript and requires no native dependencies. Generate SVGs server-side for full control without API rate limits. This is the recommended approach for applications generating thousands of unique backgrounds.
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.