Skip to content

G3dar/imgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI-Only Image Generator 🎨

Pure command-line image generation using Stable Diffusion. No UI, no web server - just a simple Python script.

Features

✅ Pure CLI - no web interface needed ⚡ SDXL Lightning - ultra-fast 4-step generation 🎮 Optimized for RTX 4090 (works on any NVIDIA GPU) 🚀 1-2 second generation time 📦 Uses HuggingFace Diffusers (industry standard)

Quick Start

1. Install Dependencies

cd imgen_cli
pip install -r requirements.txt

Optional but recommended for RTX 4090:

pip install xformers

2. Generate Your First Image

python generate.py -p "a beautiful sunset over mountains"

That's it! Your image will be saved in the outputs/ folder.

Usage Examples

Basic generation

python generate.py -p "a cyberpunk cityscape at night, neon lights"

With negative prompt

python generate.py -p "portrait of a cat" -n "blurry, low quality, distorted"

More steps for better quality

python generate.py -p "detailed fantasy landscape" -s 8

Different resolution

python generate.py -p "abstract art" -w 768 -h 768

Reproducible results (same seed)

python generate.py -p "red sports car" --seed 42

All options combined

python generate.py \
  -p "majestic dragon flying over castle" \
  -n "blurry, low quality" \
  -s 8 \
  -w 1024 \
  -h 1024 \
  --seed 12345 \
  -o my_images

Command-Line Options

Option Short Description Default
--prompt -p Image description (required) -
--negative -n Negative prompt ""
--steps -s Number of steps 4
--width -w Image width 1024
--height -h Image height 1024
--seed - Random seed Random
--output -o Output directory outputs
--model -m Model to use SDXL-Lightning

Performance

With RTX 4090:

  • First run: ~30 seconds (model download + loading)
  • Subsequent runs: ~1-2 seconds per image
  • VRAM usage: ~8-10 GB
  • Resolution: Up to 1024x1024

Models

Default: SDXL Lightning (Recommended)

python generate.py -p "your prompt"
  • Ultra-fast (4 steps)
  • Excellent quality
  • Best for most use cases

Alternative Models

You can use other models from HuggingFace:

# Stable Diffusion XL Base
python generate.py -p "your prompt" -m "stabilityai/stable-diffusion-xl-base-1.0" -s 20

# Stable Diffusion 2.1
python generate.py -p "your prompt" -m "stabilityai/stable-diffusion-2-1" -s 30

Troubleshooting

Out of memory errors

  • Reduce resolution: -w 768 -h 768
  • Use fewer steps: -s 2

Slow generation

  • Make sure you have CUDA installed
  • Install xformers: pip install xformers
  • Check GPU usage: nvidia-smi

Model not found

The model will auto-download on first run. Make sure you have internet connection and ~7GB free disk space.

Tips for Better Images

  1. Be specific in prompts: "portrait of elderly wizard with long white beard, magical staff, fantasy art" is better than "wizard"

  2. Use negative prompts: Add "-n 'blurry, low quality, distorted'" to avoid common issues

  3. Experiment with steps: SDXL Lightning works great at 4 steps, but try 6-8 for even better quality

  4. Use seeds for iteration: When you get a good image, note its seed and reuse it with variations of the prompt

  5. Batch generation: Create a simple loop in bash/PowerShell to generate multiple variations

System Requirements

  • Python 3.10+
  • NVIDIA GPU with 8GB+ VRAM (RTX 4090 recommended)
  • CUDA 11.8+ or 12.x
  • ~10GB free disk space (for models)

License

Uses HuggingFace Diffusers library. Model licenses vary by model.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages