# 🍌 Imagen Editor - User Guide

## Overview
Imagen Editor is an AI-powered image generation and editing tool using Google's Gemini "Nano Banana" API. Create stunning images from text or transform existing images with AI.

---

## 🎨 Generate Mode

### What It Does
Creates brand new images from text descriptions using AI.

### How to Use
1. Click the **"🎨 Generate"** tab
2. Write a detailed description of what you want to create
3. Select your preferred aspect ratio
4. Click **"Generate Image"**
5. Wait 10-30 seconds for AI to create your image

### Tips for Best Results
- **Be specific**: Instead of "a cat", try "a fluffy orange tabby cat sitting on a windowsill"
- **Include style**: Add keywords like "photorealistic", "watercolor", "digital art", "cinematic"
- **Describe lighting**: "golden hour lighting", "dramatic shadows", "soft natural light"
- **Add mood**: "peaceful", "energetic", "mysterious", "whimsical"
- **Specify quality**: "8k", "high detail", "professional photography"

### Example Prompts
```
✅ Good: "A photorealistic nano banana dish served on a glowing plate in a futuristic restaurant, with purple and cyan neon lights, cinematic lighting, 8k quality"

✅ Good: "A watercolor painting of a sunset over mountains, soft pastel colors, dreamy atmosphere, painted by a master artist"

❌ Too vague: "a banana"
```

---

## ✏️ Edit Mode (Very Cool!)

### What It Does
Upload any image and transform it with AI! This is incredibly powerful and versatile.

### How to Use
1. Click the **"✏️ Edit Image"** tab
2. Upload an image (PNG, JPG, WebP up to 10MB)
3. Write instructions describing how you want to modify it
4. Click **"Edit Image"**
5. AI will transform your image based on your instructions

### What You Can Do

#### 🎭 Style Transformations
- "Make this look like a vintage 1950s photograph"
- "Transform into a watercolor painting"
- "Convert to anime style"
- "Make it look like a professional studio portrait"

#### 🌅 Background Changes
- "Change the background to a tropical beach at sunset"
- "Put this person in front of the Eiffel Tower"
- "Replace background with a starry night sky"

#### ➕ Add Objects
- "Add a nano banana in the person's hand"
- "Put sunglasses on the subject"
- "Add floating bubbles around the scene"

#### 🎨 Enhancements
- "Make the colors more vibrant"
- "Add dramatic lighting"
- "Increase the detail and sharpness"
- "Make it look more professional"

#### 💡 Creative Combinations
- "Use this photo as inspiration but make it futuristic"
- "Keep the composition but change it to a cartoon style"
- "Reimagine this scene in a fantasy setting"

### Example Edit Instructions
```
✅ "Change the background to a tropical beach at sunset with palm trees"
✅ "Make it look like a vintage 1950s Kodachrome photograph"
✅ "Add a nano banana in the person's hand and make the lighting more dramatic"
✅ "Transform into a watercolor painting style while keeping the subject recognizable"
```

---

## ⚠️ Important Privacy Notice

### Public Gallery
- **All generated images are saved to a public gallery**
- Images may be visible to other users
- Images are stored permanently in our database

### What NOT to Upload
❌ Personal photos with identifiable information  
❌ Private or sensitive images  
❌ Copyrighted material you don't own  
❌ Inappropriate or offensive content  

### What's Safe to Upload
✅ Stock photos  
✅ Your own creative work you're willing to share  
✅ Public domain images  
✅ Images you have permission to use  

---

## 📸 Image History

- Your last 10 generated/edited images are shown in the History section
- Click any thumbnail to view the full image
- Images are stored in the database with:
  - Original prompt
  - Generation time
  - File size and dimensions
  - Timestamp

---

## 🔧 Technical Details

### Supported Formats
- **Input**: PNG, JPG, JPEG, WebP
- **Output**: PNG (base64 encoded)
- **Max file size**: 10MB

### Aspect Ratios
- Square (1:1) - 1024x1024
- Landscape (16:9) - 1920x1080
- Portrait (9:16) - 1080x1920
- Standard (4:3) - 1024x768
- Vertical (3:4) - 768x1024

### Generation Time
- Typical: 10-30 seconds
- Complex images may take longer
- Network speed affects download time

### API
- Powered by Google Gemini 2.5 Flash Image
- Model: `gemini-2.5-flash-image`
- Free tier with rate limits

---

## 💡 Pro Tips

### For Generate Mode
1. **Layer your description**: Subject → Setting → Style → Lighting → Quality
2. **Use reference terms**: "like a National Geographic photo", "Studio Ghibli style"
3. **Experiment**: Try different phrasings if results aren't perfect
4. **Be patient**: Complex prompts may need refinement

### For Edit Mode
1. **Start simple**: Test with basic edits first
2. **Be specific about what to keep**: "Keep the person but change the background"
3. **Combine multiple changes**: You can request several modifications at once
4. **Use it creatively**: Don't just edit - reimagine!

### General Tips
- Save images you like immediately (Download button)
- Check History for previous generations
- Experiment with different aspect ratios
- Read the placeholder text for inspiration

---

## 🐛 Troubleshooting

### "Invalid response format" Error
- The API response structure changed
- Try again in a few seconds
- Check console for detailed logs

### "Quota exceeded" Error
- API rate limit reached
- Wait 15-60 seconds and try again
- Free tier has daily limits

### Image Upload Fails
- Check file size (max 10MB)
- Ensure file is PNG, JPG, or WebP
- Try a different image

### Slow Generation
- Normal for complex prompts
- Check your internet connection
- Server may be under load

---

## 🎯 Best Practices

1. **Start with clear prompts** - Be specific about what you want
2. **Iterate and refine** - Adjust your prompt based on results
3. **Respect privacy** - Don't upload sensitive images
4. **Save your favorites** - Download images you want to keep
5. **Experiment freely** - Try creative and unusual combinations
6. **Check the history** - Learn from previous successful prompts

---

## 📞 Support

For issues or questions:
- Check the troubleshooting section above
- Review console logs (F12 in browser)
- Contact the site administrator

---

**Happy Creating! 🎨✨**
