AI Image Generation & Editing
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx
- ToBeMigrated/ai_writers/ai_outline_writer/README.md
- ToBeMigrated/ai_writers/blog_rewriter_updater/README.md
- ToBeMigrated/ai_writers/ai_copywriter/README_TBD.md
- backend/llm_providers/text_to_image_generation/main_generate_image_from_prompt.py
- backend/services/linkedin/image_generation/linkedin_image_generator.py
- backend/linkedin_image_generation.py
The AI Image Generation & Editing system in ALwrity is a multi-modal component designed to produce high-quality visual assets that complement AI-generated text content. It utilizes advanced models such as Google Gemini (Imagen) and DALL-E 3 to create platform-specific imagery, ranging from professional LinkedIn visuals to artistic blog illustrations. The system is integrated directly into content workflows, allowing for content-aware prompt generation and real-time image placement within articles and social media posts.
Sources: README.md:1-20, README.md:145-155, ToBeMigrated/ai_writers/ai_outline_writer/README.md:158-165
System Architecture and Providers
ALwrity employs a modular backend architecture for image generation, supporting multiple AI providers to ensure flexibility and fallback capabilities. The system primarily integrates with Google Gemini's Imagen API but is designed to support other engines like Stability AI and DALL-E 3.
Image Generation Engines
| Provider | Capability | Usage Context |
|---|---|---|
| Google Gemini (Imagen) | Primary text-to-image API | Default for high-quality, content-aware generation |
| OpenAI (DALL-E 3) | High-fidelity image generation | Creative and artistic blog illustrations |
| Stability AI | Fast latent diffusion generation | Alternative for varied artistic styles |
Sources: README.md:150-155, ToBeMigrated/ai_writers/ai_outline_writer/README.md:15-25, ToBeMigrated/ai_writers/ai_outline_writer/README.md:158-165
Data Flow for Visual Content Creation
The generation process follows a structured pipeline: analyzing text content, generating optimized prompts, and finally invoking the selected image engine.
The diagram shows how raw content is transformed into a visual asset via specialized AI prompt generation and multi-engine selection.
Sources: ToBeMigrated/ai_writers/ai_outline_writer/README.md:100-115, frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:10-50
Platform-Specific Implementation
LinkedIn Visual Optimization
The platform provides a dedicated service for LinkedIn, which includes two distinct steps: generating specialized prompts based on the post's industry and topic, and then generating the actual image with specific aspect ratios.
- Prompt Generation: Analyzes content type (post, article, carousel) and industry to create three optimized prompts.
- Image Generation: Supports aspect ratio configuration (defaulting to 1:1) and professional/creative style selections.
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:15-85, ToBeMigrated/ai_writers/ai_copywriter/README_TBD.md:90-105
Blog and Article Integration
For long-form content, the system supports automatic image placement and stylistic consistency across sections.
- Style Options: Includes realistic, illustration, minimalist, photographic, and artistic.
- Metadata Management: Includes image prompts, paths, and captions in the exported Markdown or HTML.
- Automatic Placement: Optimal placement suggestions based on heading hierarchy.
Sources: ToBeMigrated/ai_writers/ai_outline_writer/README.md:158-175, ToBeMigrated/ai_writers/blog_rewriter_updater/README.md:70-80
Technical Workflow: Content-Aware Generation
The system uses a generateLinkedInImagePrompts action to bridge the gap between text and visuals. This ensures that the generated image is not just a random illustration but is strategically aligned with the marketing message.
LinkedIn Image API Parameters
| Parameter | Type | Description |
|---|---|---|
content_type | string | Post, article, carousel, or video_script |
topic | string | Main subject of the content |
industry | string | Contextual industry (e.g., Technology, Healthcare) |
prompt | string | The AI-optimized text description for generation |
aspect_ratio | string | Default is '1:1' for LinkedIn posts |
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:15-35, frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:65-80
Interaction Sequence
The following sequence diagram illustrates the interaction between the frontend Copilot actions and the backend image services.
This diagram depicts the two-step process of prompt selection followed by actual asset generation to ensure user control over the final visual output.
Sources: frontend/src/components/LinkedInWriter/RegisterLinkedInActions.tsx:15-95
Image Editing and Optimization
While "Editing" in the current implementation focuses on "Regeneration" and "Refinement" rather than pixel-level manipulation, the system provides several quality control features:
- AI Quality Assessment: Evaluates the relevance and aesthetic quality of the generated image against the content.
- Prompt Refinement: Users can view and edit the underlying AI prompts to tweak the visual results.
- Style Consistency: Pre-defined style guidelines (Professional vs. Creative) to maintain brand identity.
- Platform-Specific Optimization: Automatic sizing for different social media aspect ratios.
Sources: README.md:155-165, ToBeMigrated/ai_writers/ai_outline_writer/README.md:170-180, ToBeMigrated/ai_writers/ai_copywriter/README_TBD.md:95-115
Conclusion
The AI Image Generation & Editing system provides a critical multi-modal layer to the ALwrity platform. By integrating with high-tier providers and offering content-aware prompt engineering, it enables users to generate cohesive visual-textual marketing assets without leaving the application workflow.
Sources: README.md:145-155, ToBeMigrated/ai_writers/ai_outline_writer/README.md:158-165