GenImage Inserter

pending

by kunihiros

Generate images from note text using Gemini AI and insert them into your notes.

Updated 1mo ago0BSDDiscovered via Obsidian Unofficial Plugins
View on GitHub

GenImage Inserter

An Obsidian plugin that generates images from your note text using Gemini AI and inserts them directly into your notes.

Demo

  • Easy to use! (Not so first as it is though, in case of gemini3pro image πŸ˜‡)
    Demo

Features

  • 🎨 Generate images from selected text or entire note content using Gemini AI
    • no text selection makes an entire note as context to generate.
  • πŸ“ Multiple prompt templates with customizable aspect ratio and image quality
  • πŸ–±οΈ Right-click context menu integration
  • πŸ“ Images saved to configurable directory within your vault (organized by note name)
  • πŸ“‹ Detailed logging for troubleshooting

Supported Models

ModelSpeedQualityaspect_ratioimage_size
gemini-2.5-flash-imageFastGoodβœ… Supported❌ Not supported (fixed 1024Γ—1024)
gemini-3-pro-image-previewSlowerHighβœ… Supportedβœ… Supported (1K/2K/4K)

Recommend: 3-pro

Installation

Manual Installation

  1. Download main.js, manifest.json, and styles.css from the latest release
  2. Create a folder genimage-inserter in your vault's .obsidian/plugins/ directory
  3. Copy the downloaded files into the folder
  4. Reload Obsidian and enable the plugin in Settings β†’ Community plugins

Configuration

Plugin Settings

SettingDescriptionRequired
.env file pathPath to your .env file (must be outside your vault for security). Supports ~ for home directory (e.g., ~/.config/secrets/.env)βœ“
Prompt directoryDirectory containing your prompt .md files (relative to vault root)βœ“
Image output directoryDirectory where generated images will be saved (relative to vault root, empty = vault root)
Notification delaySeconds before showing "Generating..." notification (0 = immediate)

.env File Format

Create a .env file outside your vault with the following content:

LLM_PROVIDER=gemini #LLM Provider is currently fixed to GEMINI
GEMINI_API_KEY=your_api_key_here
GEMINI_MODEL=gemini-3-pro-image-preview

Recommended path: Use ~/.config/genimage-inserter/.env to ensure cross-platform compatibility (Linux, macOS, Windows).

⚠️ Security: The .env file must be outside your vault to prevent accidental sync or exposure of your API key.

Prompt Files

Create .md files in your prompt directory. Each file can optionally include YAML frontmatter to specify image generation parameters:

---
aspect_ratio: "16:9"
image_size: "2K"
---
Your system prompt text here...

Describe what kind of images you want the AI to generate.

Available Parameters

ParameterValuesDefaultNotes
aspect_ratio1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:91:1Works with all models
image_size1K, 2K, 4K1KOnly works with gemini-3-pro-image-preview

Example Prompt Files

Illustration style (illustration.md):

---
aspect_ratio: "16:9"
image_size: "2K"
---
You are an illustrator. Create a beautiful illustration based on the following text.
Use vibrant colors and warm, inviting style.

Photorealistic (realistic.md):

---
aspect_ratio: "1:1"
---
Generate a photorealistic image based on the following text.
Focus on natural lighting and composition.

Simple (no frontmatter, uses defaults):

Create an image based on the following text.

Usage

  1. Open a note in Obsidian
  2. Right-click and select Generate image
  3. Choose a prompt template from the modal
  4. Wait for the image to be generated
  5. The image is automatically saved and inserted into your note

With Selected Text

If you select text before right-clicking:

  • The selected text is sent to the AI as context
  • The generated image is inserted at the end of the selection

Without Selection (Entire Note)

If no text is selected:

  • The entire note content is sent to the AI as context
  • The generated image is inserted at the end of the note

⚠️ Note: The image link is inserted at the last line of the note with a single line break. If your note ends within a code block (```), fenced block, or other Markdown structure, the image link may be inserted inside that structure and displayed as plain text. In such cases, manually move the image link outside the structure.

Output Structure

Generated images are saved in a folder named after your note:

{image output directory}/{note name}/{timestamp}_{note_name}.{ext}

Example: If your note is "My Travels" and output directory is assets/generated:

assets/generated/My Travels/20260207143052_My_Travels.png

Image Link Format

Images are inserted using standard Markdown syntax for maximum compatibility:

![](assets/generated/My%20Travels/20260207143052_My_Travels.png)

Logging

Logs are saved to .obsidian/plugins/genimage-inserter/genimage-inserter.log for debugging purposes.

Development

# Install dependencies
pnpm install

# Development build (watch mode)
pnpm run dev

# Production build
pnpm run build

# Run tests
pnpm run test

License

0-BSD

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.