This document covers Lovable's specialized capabilities for AI-powered image generation and document content extraction. These tools enable web applications to create visual assets dynamically and process user-uploaded documents without external service dependencies. For general file operations, see File Operations and Line-Replace Editing. For external resource handling, see Dependency Management and Search Tools.
Lovable provides two distinct content processing subsystems:
imagegen--generate_image, imagegen--edit_image)document--parse_document)Both subsystems operate as integrated tools within Lovable's agent architecture, enabling automated asset creation and document parsing workflows.
Lovable provides two FLUX models with distinct performance characteristics:
| Model | Use Case | Performance | Max Resolution | Selection Criteria |
|---|---|---|---|---|
flux.schnell | Small images, icons, thumbnails | Fast | 1920x1920 | Default; images < 1000px |
flux.dev | Hero images, fullscreen banners | Slower, higher quality | 1920x1920 | Large images, explicit quality requests |
Dimension Constraints:
The tool automatically selects flux.schnell unless the image size, placement context, or user requirements indicate the need for flux.dev.
Sources: Lovable/Agent Tools.json299-327
Prompt Engineering Guidelines Lovable/Agent Tools.json300-327:
Example Prompt Structure:
A 16:9 aspect ratio hero image of a sunset over a calm ocean. Ultra high resolution.
Sources: Lovable/Agent Tools.json299-327
The imagegen--edit_image tool provides two operational modes:
Single Image Edit Examples Lovable/Agent Tools.json328-351:
"make it rainy" - Add weather effects"change to sunset lighting" - Modify lighting"add snow" - Environmental changes"make it more colorful" - Color enhancementMultiple Image Merge Examples:
"blend these two landscapes seamlessly""combine the foreground of the first image with the background of the second""merge these portraits into a group photo""create a collage from these images"Use Case: Object Consistency: The tool excels at maintaining character or object consistency across scenes by reusing the same base image in different contexts.
Sources: Lovable/Agent Tools.json328-351
Parameters Lovable/Agent Tools.json301-327:
prompt (required): Text description with aspect ratio and quality hintstarget_path (required): Save location, prefer src/assets/ folderwidth (optional): Image width, default determined by modelheight (optional): Image height, default determined by modelmodel (optional): "flux.schnell" (default) or "flux.dev"Critical Constraint: Generated images must be imported as ES6 modules:
Important Note Lovable/Agent Tools.json300-301: Do not replace user-uploaded images with generated images unless explicitly requested.
Sources: Lovable/Agent Tools.json299-327
Parameters Lovable/Agent Tools.json330-351:
image_paths (required): Array of source image paths
prompt (required): Edit/merge instructionstarget_path (required): Output file pathPreferred Usage: When users request image tweaks, use imagegen--edit_image rather than generating a new image from scratch.
Sources: Lovable/Agent Tools.json328-351
The document--parse_document tool provides comprehensive document content extraction:
Processing Capabilities Lovable/Agent Tools.json286-298:
Page Limit: First 50 pages are processed per document.
Sources: Lovable/Agent Tools.json286-298
Parameter Lovable/Agent Tools.json289-298:
file_path (required): Path to document file, typically from user-uploads:// virtual filesystemIntegration Pattern: Document parsing typically follows this workflow:
user-uploads://)document--parse_document with uploaded file pathSources: Lovable/Agent Tools.json286-298
Both image and document tools interact with Lovable's virtual filesystem structure:
Key Integration Points:
Image Generation Lovable/Agent Tools.json316-317:
src/assets/ folderImage Editing:
user-uploads:// or project rootDocument Processing Lovable/Agent Tools.json286-298:
user-uploads:// virtual filesystemFilesystem Tool Relationship: For copying files between virtual filesystems, see lov-copy tool in Dependency Management and Search Tools.
Sources: Lovable/Agent Tools.json127-143 Lovable/Agent Tools.json286-298 Lovable/Agent Tools.json299-351
| Requirement | Tool | Key Parameters |
|---|---|---|
| Generate new image | imagegen--generate_image | prompt, target_path, model |
| Edit existing image | imagegen--edit_image | image_paths (1), prompt, target_path |
| Merge multiple images | imagegen--edit_image | image_paths (2+), prompt, target_path |
| Extract PDF content | document--parse_document | file_path |
| Process Office documents | document--parse_document | file_path |
| Extract audio transcription | document--parse_document | file_path |
Model Selection for Image Generation:
if image_size < 1000px or standard_quality:
use flux.schnell # Default, fast
elif image_size >= 1000px or hero_image or user_requests_quality:
use flux.dev # Slower, higher quality
Sources: Lovable/Agent Tools.json286-351
Dimension Rules Lovable/Agent Tools.json304-322:
Import Requirement Lovable/Agent Tools.json300-301:
User Upload Protection Lovable/Agent Tools.json300-301: Never replace user-uploaded images with AI-generated images unless explicitly requested by the user.
Page Limit Lovable/Agent Tools.json287: Only the first 50 pages of documents are processed.
Format Support: While the tool supports "many other formats" beyond PDF, Word, PowerPoint, Excel, and MP3, the exact list is not enumerated in the tool description.
Both image generation and document parsing are I/O-bound operations. When multiple images need generation or multiple documents require parsing, invoke tools in parallel rather than sequentially for performance optimization. This pattern aligns with Lovable's general parallel execution strategy (see File Operations and Line-Replace Editing).
Sources: Lovable/Agent Tools.json286-351
Refresh this wiki