fal-image-gen
Skill1 starsChanged 3 months agoMITView on GitHub
Generate and edit images through fal.ai. Use when the user wants to generate, regenerate, or edit an image via fal, asks for gpt-image-2, gpt-img-2, rembg, or a transparent PNG, or wants a logo, hero art, or mockup rendered. Covers the queue API, cost-aware quality selection, and transparency post-processing.
In this repository22 other files it gives its agents.
- skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- agent-browserSkill
- design-taste-frontendSkill
- find-skillsSkill
- ft-netbird-shareSkill
- ft-readme-styleSkill
- ft-visual-styleSkill
- gitadelSkill
- impeccableSkill
- react-bits-proSkill
- react-doctorSkill
- researchSkill
- rust-best-practicesSkill
- scorchSkill
- shell-secretsSkill
- supermemory-auditSkill
- svelte-code-writerSkill
- svelte-core-bestpracticesSkill
- unslopSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 80
Never default to high.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
fal image generation
Generate and edit images through fal.ai using the FAL_AI key. Draft cheap, upgrade on request.
Auth
The key lives in the environment as FAL_AI. Never hardcode it, never print it. Send it as a header:
Authorization: Key $FAL_AIModels
| Purpose | Endpoint |
| Text to image | fal-ai/gpt-image-2 |
| Image edit (mask/inpaint) | fal-ai/gpt-image-2/image-to-image |
| Background removal | fal-ai/imageutils/rembg |
| Transparency conversion | fal-ai/imageutils/transparency |
Request flow
Submit to the queue, poll the status URL until COMPLETED, fetch the result. Use the status_url and response_url from the submit response; they are authoritative even when they sit under a different model path.
# 1. submit
curl -s -H "Authorization: Key $FAL_AI" -H "Content-Type: application/json" \
-d '{"prompt": "...", "image_size": "square", "quality": "low", "output_format": "png", "num_images": 1}' \
https://queue.fal.run/fal-ai/gpt-image-2
# -> {"request_id": "...", "status_url": "...", "response_url": "..."}
# 2. poll status_url until status == COMPLETED (sleep 5 between polls)
# 3. fetch result
curl -s -H "Authorization: Key $FAL_AI" "$RESPONSE_URL" | jq -r '.images[0].url'Large inputs, like base64 images, go in a body file, never on the command line:
B64=$(base64 -w0 image.png)
jq -nc --arg u "data:image/png;base64,$B64" '{image_url: $u}' > body.json
curl -s -H "Authorization: Key $FAL_AI" -H "Content-Type: application/json" \
-d @body.json https://queue.fal.run/fal-ai/imageutils/rembgThe sync endpoint https://fal.run/<model> works for short jobs but times out on image generation; prefer the queue.
Parameters (gpt-image-2)
prompt: requiredimage_size: preset or{"width": N, "height": N}. Presets:square(512x512),square_hd(1024x1024),portrait_4_3,portrait_16_9,landscape_4_3,landscape_16_9,auto. Custom dims: both edges multiples of 16, max edge 3840, total pixels 655,360 to 8,294,400quality:low|medium|high(defaulthigh, the cost driver)num_images: 1-4output_format:jpeg|png|webpsync_mode: true returns data URIs and skips request historyopenai_api_key: optional BYOK, routes through your own OpenAI quota
Pricing (per image)
| Size | low | medium | high |
| 1024x768 | $0.005 | $0.037 | $0.145 |
| 1024x1024 | $0.006 | $0.053 | $0.211 |
| 1024x1536 | $0.005 | $0.042 | $0.165 |
A 512x512 square low draft costs a fraction of a cent.
Cost protocol
- Draft default:
image_size: "square",quality: "low",output_format: "png",num_images: 1. - Show the result, then ask the user before any pricier regeneration. Quote the upgrade, e.g. "regenerate at medium 1024x1024? +$0.047".
square_hd+mediumonly on explicit request. Reservequality: "high"for final hero assets.- Never default to high.
Transparency
gpt-image-2 ignores transparent-background prompts and always paints an opaque field. Expect it and post-process:
- Uniform field: global color key.
magick in.png -fuzz 7% -transparent '<bg>' out.png. Flood-fill alone is not enough; it leaves background enclosed by the subject, so use the global key. - Photos:
fal-ai/imageutils/rembg(inputimage_url, outputimage.url). - Saliency removers drop thin structural lines, so keying beats rembg for line art and logos.
- ChatGPT image generation does honor transparency prompts (alpha comes out real), so it is the better route when native alpha is required.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

