$ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' if (-not $env:FAL_KEY) { $env:FAL_KEY = [System.Environment]::GetEnvironmentVariable("FAL_KEY","User") } if (-not $env:FAL_KEY) { throw "FAL_KEY not set." } $auth = @{ Authorization = "Key $env:FAL_KEY" } $dir = "C:\Users\CAN\tinqs-ltd\tattoo-test\gen-v5" $log = "$dir\_gen-sleeves-v5.log" "START $(Get-Date -Format o)" | Out-File $log # v5 limb sleeves: RECTANGULAR dense pattern textures, wrapped around the limb # with a MIRRORED repeat by bake_v5.gd (mirror = seamless at the loop points, # no left/right edge matching required). Chest/back stay on the v3 planar art. $style = "Polynesian / Micronesian TRIBAL tattoo pattern, solid black ink on off-white parchment. Thick black shapes carved with thin NEGATIVE-SPACE lines, koru spirals, shark-tooth (niho) notches, light dotwork. Confident linework, strong tribal character." $fill = "FULL-BLEED RECTANGULAR SLEEVE TEXTURE: dense continuous tribal patternwork covering the ENTIRE canvas edge-to-edge on all four sides - stacked horizontal pattern bands flowing top to bottom. Parchment appears ONLY as thin negative-space linework inside the pattern, never as empty areas, borders or margins. The pattern must run fully to the left and right edges without a framing border." $neg = "No color, no grey shading, no gradient, no photoreal, no 3D, no human figure, no text, no outer border or frame, no vignette. Keep carved negative-space detail crisp - not a solid black field." $jobs = @( @{ part="arm_r"; mark="chiefs-mark"; d="Theme - CHIEF'S CREST: a bold spearhead crown with a fan of broad rays as the TOP band (shoulder); below it, continuous bands of interlocking koru spirals and niho tooth rows down to the BOTTOM edge (wrist)." } @{ part="arm_l"; mark="iron-spine"; d="Theme - IRON SPINE (warrior): two bold crossed spears with barbed heads as the TOP band (shoulder); below it, continuous stacked rows of shark-tooth (niho) triangles, spearhead chevrons and small spirals down to the BOTTOM edge (wrist)." } @{ part="leg_r"; mark="voyagers-current"; d="Theme - VOYAGER'S CURRENT (ocean): a big bold curling koru WAVE as the TOP band (thigh); below it, continuous flowing current bands, wave scrolls and spiral eddies down to the BOTTOM edge (ankle)." } @{ part="leg_l"; mark="storm-bearer"; d="Theme - STORM BEARER: a bold LIGHTNING bolt flanked by two storm-cloud koru scrolls as the TOP band (thigh); below it, continuous bands of jagged rain lines, zigzag bolts and dotwork down to the BOTTOM edge (ankle)." } ) $perImage = 0.17 # GPT Image 2, quality=high (estimate) $runCost = 0.0; $ok = 0; $fail = 0; $skip = 0 foreach ($j in $jobs) { $name = "v5_$($j.part)_$($j.mark)" $path = "$dir\$name.png" if (Test-Path $path) { $skip++; "SKIP $name (exists)" | Tee-Object -FilePath $log -Append | Out-Null; continue } Write-Host "=== $name ===" -ForegroundColor Cyan $prompt = "$style`n$fill`n$($j.d)`nSTRICT: $neg" try { $body = @{ prompt=$prompt; image_size="portrait_4_3"; quality="high"; num_images=1 } | ConvertTo-Json -Depth 6 -Compress $resp = Invoke-RestMethod -Method Post -Uri "https://fal.run/openai/gpt-image-2" -Headers $auth -ContentType 'application/json' -Body $body -TimeoutSec 600 Invoke-WebRequest -Uri $resp.images[0].url -OutFile $path -TimeoutSec 300 $runCost += $perImage; $ok++ "OK $name" | Tee-Object -FilePath $log -Append | Out-Null Write-Host " OK" -ForegroundColor Green } catch { $fail++ "FAIL $name : $($_.Exception.Message) $($_.ErrorDetails.Message)" | Tee-Object -FilePath $log -Append | Out-Null Write-Host " FAIL: $($_.Exception.Message)" -ForegroundColor Red } } "DONE ok=$ok fail=$fail skip=$skip RUN_COST_USD=$([math]::Round($runCost,2)) $(Get-Date -Format o)" | Tee-Object -FilePath $log -Append Write-Host ("RUN_COST_USD={0:N2} ok={1} fail={2} skip={3}" -f $runCost,$ok,$fail,$skip) -ForegroundColor Yellow