Generate Images on Perchance AI Text-To-Image
Purpose
Drive Perchance's free, no-signup AI Text-To-Image generator to produce images from a text prompt, apply the available style and rendering options, wait for the batch to finish, and extract each result's metadata (expanded prompt, guidance scale, per-image seed) and inline image bytes. Optionally save the best result(s) to the generator's private gallery. Useful for bulk/iterative image generation where you want full control over style, shape, batch size, and per-image seeds. This is a generation task — nothing is purchased and there is no account; it is free and unlimited.
When to Use
- Generate one or more AI images from a natural-language prompt, free and without login.
- Bulk-generate a batch (4–32 images) and pick/save the best candidate(s).
- Exercise specific creative controls: art style preset, aspect ratio (shape), image count, and prompt modifiers (camera shot, color, effect, genre).
- Capture the exact generation parameters (expanded prompt, guidance scale, seed) for reproducibility or downstream analysis.
Workflow
The recommended (and only viable) method is browser: the generator is powered by Perchance's in-browser text-to-image-plugin running inside nested iframes — there is no documented public REST API or query-string deep-link that triggers generation, so scripted browsing of the embedded UI is the correct path.
- Start a stealth remote session. The
perchance.orgdomain sits behind Cloudflare (the bare homepage returns HTTP 403). Create the session with--verified --proxies(i.e.browse open … --remoteagainst a verified + residential-proxy session). Navigate tohttps://perchance.org/ai-text-to-image-generator. Wait ~3s, then confirm the page title isAI Image Generator (free, no sign-up, unlimited). - Snapshot to get cross-frame refs. Run
browse snapshot. It flattens the nested iframes via CDP and exposes stable refs in the[1-*]namespace (the generator lives inside#outputIframeEl, NOT on the top page). Key controls:[1-3]— Description / prompt textbox (pre-filled with an example; justbrowse fillover it).[1-4]— 🎨 Art Style<select>(default "Painted Anime"; 80+ options: Cinematic, Casual Photo, Digital Painting, Concept Art, "No style", Studio Ghibli, Pixel Art, Watercolor, Manga, …).[1-5]— 🖼️ Shape<select>: Square (default) / Portrait / Landscape.[1-6]— 🔢 How many?<select>: 4 (default) / 6 / 8 / 16 / 32 / 2.[1-9]— "✨ generate" button.- Optional prompt-modifier selects that appear near the prompt: "Add shot…", "Add color…", "Add effect…", "Add genre…".
- Fill inputs.
browse fill [1-3] "<prompt>". Optionallybrowse select [1-4] "<Art Style>",browse select [1-5] "<Shape>",browse select [1-6] "<count>"(pass the visible option label). - Generate.
browse click [1-9]. - Wait and poll for completion. Each requested image renders in its own nested "Perchance Image Generation Embed" iframe. Snapshots first show placeholders ("Waiting…" / "Preparing…"); an image is finished only when its
imagenode's accessible name contains aseed=value. Poll withbrowse snapshotevery ~20s. Budget 30–90s per batch — large batches (16/32) take longer. Do not stop after the first snapshot or you will capture only a partial batch. - Extract results. For each finished
imagenode, parse its accessible name:prompt=<expanded prompt + style keywords> negativePrompt=<…> guidanceScale=<n> seed=<n>. The raw pixels are available as an inlinedata:image/jpeg;base64,…srcon the embed's image element (there is no external CDN URL). - (Optional) Save the best. Click the
🛡️💾button beneath the chosen image to save it to the private gallery (viewable via the🛡️ show private gallerybutton). Pick based on prompt intent; do not blindly save all. - Screenshot the results grid as evidence.
Site-Specific Gotchas
- Cloudflare 403 on the domain. A bare HTTP request to
perchance.orgreturns 403. Use a stealth remote session (verified + residential proxies). In testing the generator subpage occasionally loaded on a plain Browserbase remote session too, but this is not reliable — keep stealth on to avoid intermittent challenges. - Nested iframes — three layers deep. The generator is NOT on the top page. It lives in
#outputIframeEl(a*.perchance.orgsubdomain iframe), and each result renders in a further-nested "Perchance Image Generation Embed" iframe. Usebrowse snapshot(which flattens frames via CDP into[1-*],[60-*],[61-*]… refs) rather than trying to readiframe.contentDocument(cross-origin → null). - Image bytes are inline base64, not URLs. Finished images are
data:image/jpeg;base64,…blobs painted into sandboxed embed canvases. There is no external/CDN image URL to grab. Capture the data URI from thesrc, or read the metadata from theimagenode's accessible name. - All generation metadata is in the accessibility name. Each finished
imagenode encodesprompt=,negativePrompt=,guidanceScale=(defaults to 7), andseed=(random per image). This is the most reliable structured output. - Selecting an art style mutates the expanded prompt. Choosing e.g. "Cinematic" auto-appends keywords (75mm, Technicolor, Panavision, cinemascope, HDR, "world-class cinematic masterpiece", …) to the prompt visible in the image node name. Expected, not a bug.
- Default batch is 4. Leave "How many?" modest; 16/32 dramatically increase wait time. Partial-batch capture is the most common failure — poll until all requested images carry a
seed=. - Ad iframes pollute the snapshot.
ads.perchance.org, doubleclick, pubmatic, etc. add dozens of irrelevant refs. Ignore everything outside the generator frames. - No login / no payment / unlimited & free. No auth wall to clear; never attempt to log in.
Expected Output
{
"success": true,
"prompt": "a cozy cabin in a snowy pine forest at sunset, warm glowing windows",
"style": "Cinematic",
"settings": {
"shape": "Square",
"num_images": 4,
"guidance_scale": 7,
"negative_prompt": ""
},
"images": [
{
"seed": 121257895,
"expanded_prompt": "a cozy cabin in a snowy pine forest at sunset, warm glowing windows, cinematic shot, dynamic lighting, 75mm, Technicolor, Panavision, cinemascope, sharp focus, fine details, 8k, HDR, ... cinematic color grading, depth of field.",
"src": "data:image/jpeg;base64,/9j/4AAQSkZ...",
"saved": false
},
{
"seed": 272163316,
"expanded_prompt": "a cozy cabin in a snowy pine forest at sunset, warm glowing windows, cinematic shot, ...",
"src": "data:image/jpeg;base64,/9j/4AAQSkZ...",
"saved": true
}
],
"image_count": 2,
"error_reasoning": null
}
Failure / partial shapes:
// Still rendering at capture time — poll longer
{ "success": true, "image_count": 2, "images": [ { "seed": null, "src": null, "alt": "Waiting... (not yet complete)" } ], "error_reasoning": null }
// Blocked by Cloudflare (no stealth)
{ "success": false, "image_count": 0, "images": [], "error_reasoning": "Cloudflare 403 / challenge page — recreate session with --verified --proxies" }