Skip to content

AI Commands

The floimg ai command group provides AI-powered text generation, image analysis, and image editing using Gemini.

Install the Google AI plugin:

Terminal window
npm install -g @teamflojo/floimg-google

Set your API key:

Terminal window
export GOOGLE_AI_API_KEY=your-api-key

Get your API key from Google AI Studio.


Generate text using Gemini AI.

Terminal window
floimg ai text --prompt "Write 3 creative prompts for a fantasy landscape"
OptionRequiredDescription
--prompt <text>YesText prompt for generation
--api-key <key>NoAPI key (or use GOOGLE_AI_API_KEY env)
--model <name>NoModel name (default: gemini-2.0-flash)
--output-format <fmt>Notext or json (default: text)
--context <text>NoAdditional context
--out <path>NoSave output to file
Terminal window
# Simple text generation
floimg ai text --prompt "Describe a cozy coffee shop in one paragraph"
# Generate structured JSON
floimg ai text \
--prompt "Generate 3 image prompts for product photos" \
--output-format json
# Save to file
floimg ai text --prompt "Write alt text for a product image" --out alt.txt
# Use specific model
floimg ai text --prompt "Complex analysis task" --model gemini-2.0-flash

Analyze images using Gemini Vision.

Terminal window
floimg ai vision --image photo.jpg --prompt "What objects are in this image?"
OptionRequiredDescription
--image <path>YesInput image path
--prompt <text>YesAnalysis prompt
--api-key <key>NoAPI key (or use GOOGLE_AI_API_KEY env)
--model <name>NoModel name (default: gemini-2.0-flash)
--output-format <fmt>Notext or json (default: text)
--out <path>NoSave output to file
Terminal window
# Describe an image
floimg ai vision --image landscape.jpg --prompt "Describe this scene"
# Extract structured data
floimg ai vision \
--image product.png \
--prompt "List all products visible with prices" \
--output-format json
# Generate alt text
floimg ai vision \
--image hero.jpg \
--prompt "Write accessible alt text for this image" \
--out alt.txt
# Content analysis
floimg ai vision \
--image photo.jpg \
--prompt "Is this image appropriate for a family website?"

Edit images using Gemini’s native image generation (Nano Banana).

Terminal window
floimg ai edit --image input.jpg --prompt "Make the sky more vibrant" --out edited.jpg
OptionRequiredDescription
--image <path>YesInput image path
--prompt <text>YesEdit instructions
--out <path>YesOutput image path
--api-key <key>NoAPI key (or use GOOGLE_AI_API_KEY env)
--model <name>NoModel (default: gemini-2.5-flash-image)
--pre-prompt <text>NoInstructions prepended to prompt
--aspect-ratio <ratio>NoOutput aspect ratio (default: 1:1)
--image-size <size>NoOutput resolution: 1K, 2K, or 4K (default: 1K)
--groundingNoEnable Google Search grounding

Supported: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9

Terminal window
# Simple edit
floimg ai edit \
--image photo.jpg \
--prompt "Remove the background and replace with white" \
--out clean.jpg
# Style transfer with 4K output
floimg ai edit \
--image portrait.jpg \
--prompt "Convert to watercolor painting style" \
--image-size 4K \
--out watercolor.jpg
# Widescreen output
floimg ai edit \
--image room.jpg \
--prompt "Add a potted plant in the corner" \
--aspect-ratio 16:9 \
--out decorated.jpg
# Use grounding for real-time data
floimg ai edit \
--image infographic.jpg \
--prompt "Update the chart with current stock prices for AAPL" \
--grounding \
--out updated.jpg
ModelDescription
gemini-2.5-flash-imageFast, high-volume (default)
gemini-3-pro-image-previewHigher quality, better text rendering

Generate images from text prompts using Gemini.

Terminal window
floimg ai generate --prompt "A cozy coffee shop interior" --out coffee-shop.png
OptionRequiredDescription
--prompt <text>YesImage description
--out <path>YesOutput image path
--api-key <key>NoAPI key (or use GOOGLE_AI_API_KEY env)
--model <name>NoModel (default: gemini-2.5-flash-image)
--aspect-ratio <ratio>NoOutput aspect ratio (default: 1:1)
--image-size <size>NoOutput resolution: 1K, 2K, or 4K (default: 1K)
--groundingNoEnable Google Search grounding
Terminal window
# Generate an image
floimg ai generate \
--prompt "A minimalist workspace with natural lighting" \
--out workspace.png
# Widescreen cinematic image
floimg ai generate \
--prompt "A photorealistic mountain lake at sunrise, mist rising from the water" \
--aspect-ratio 21:9 \
--image-size 4K \
--out landscape.png
# Specific style
floimg ai generate \
--prompt "Isometric 3D illustration of a tiny house, pastel colors, soft shadows" \
--out house.png

Combine AI commands with other floimg operations:

Terminal window
# 1. Analyze the image
floimg ai vision \
--image photo.jpg \
--prompt "Suggest one improvement for this photo" \
--out suggestion.txt
# 2. Apply the suggestion
floimg ai edit \
--image photo.jpg \
--prompt "$(cat suggestion.txt)" \
--out enhanced.jpg
Terminal window
# 1. Generate an image
floimg ai generate \
--prompt "Abstract geometric pattern" \
--out pattern.png
# 2. Resize for different uses
floimg resize pattern.png 1920x1080 --out pattern-desktop.png
floimg resize pattern.png 1080x1920 --out pattern-mobile.png
Terminal window
# 1. Analyze the current state
floimg ai vision \
--image room.jpg \
--prompt "What furniture is missing to make this room complete?" \
--out analysis.txt
# 2. Use vision output to guide edit
floimg ai edit \
--image room.jpg \
--prompt "Add the following: $(cat analysis.txt)" \
--out furnished.jpg

VariableDescription
GOOGLE_AI_API_KEYGoogle AI API key for Gemini