Upscale, enhance, increase image resolution 2x-4x. Use for: blurry, small, low-res images
Upscale an image using Topaz Image Upscaler via fal.ai async queue.
Ask the user for:
Then run the following steps:
Step 1 — Check API key:
if [ -z "$FAL_KEY" ]; then
echo "ERROR: FAL_KEY not set."
echo "Run /pocket-knife:setup to configure your API keys."
exit 1
fi
Step 2 — Submit upscaling job:
IMAGE_URL="[USER_IMAGE_URL_HERE]"
SCALE="${SCALE:-2}"
OUTPUT_FILE="${OUTPUT_FILE:-$HOME/Downloads/upscaled_$(date +%s).jpg}"
MODEL_ID="fal-ai/topaz/upscale/image"
MAX_WAIT=180
POLL_INTERVAL=5
SUBMIT_RESPONSE=$(curl --fail-with-body -s \
-X POST "https://queue.fal.run/${MODEL_ID}" \
-H "Authorization: Key $FAL_KEY" \
-H "Content-Type: application/json" \
-d "{\"image_url\": \"$IMAGE_URL\", \"scale\": $SCALE}" \
2>&1)
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
if echo "$SUBMIT_RESPONSE" | grep -qi "401\|unauthorized"; then
echo "ERROR: Invalid FAL_KEY. Check your key in ~/.claude/.env"
else
echo "ERROR: fal.ai job submission failed (code $EXIT_CODE)."
echo "$SUBMIT_RESPONSE"
fi
exit 1
fi
REQUEST_ID=$(echo "$SUBMIT_RESPONSE" | python3 -c "
import sys, json