This Quarkus project uses Gemini and google-genai library to generate image from templates. This can allows us to save time for our communication of social network.
⚠️ Be careful about the images you use. Please contact the person if you are using their images before using them and integrating them into this API.
- 🚀 Quarkus Framework: Fast startup and low memory footprint
- 🤖 Gemini AI Integration: Uses Google's latest Gemini models
- 🎨 Image Description Generation: Creates detailed descriptions for image generation
- 📝 Text Generation: General-purpose text generation capabilities
- Java 17 or higher
- Maven 3.8+
- Google AI API Key
-
Clone the repository
git clone [email protected]:zenika-open-source/agent-Z-communication-assistant.git cd agent-Z-communication-assistant
-
Set up your Google AI API Key
Option A: Environment Variable (Recommended)
export GOOGLE_API_KEY=your-api-key-here
Option B: Configuration File
# Edit src/main/resources/application.properties google.ai.api.key=your-api-key-here
-
Build the project
mvn clean compile
Development Mode (with hot reload):
mvn quarkus:dev
The application can be configured through src/main/resources/application.properties
:
# Google AI Configuration
google.ai.api.key=your-api-key-here
# Gemini Model Settings
app.gemini.model=gemini-2.5-flash-image-preview
app.result.filename=gemini-generation-image.png
app.prompt=Your custom prompt for image generation
# Media Type Configuration
app.media.type=image
# Supported values: image, video
# Template and Files Configuration
app.template.path=images/template.png
app.file1.path=images/file1.png
app.file2.path=images/file2.png
app.template.formats=png,jpg,jpeg
# Video Generation Configuration (for video media type)
app.video.ratio=16:9
app.video.resolution=1080p
# Quarkus Configuration
quarkus.http.port=8080
quarkus.log.level=INFO
The application supports two main modes: Image Generation and Video Generation.
app.media.type
: Set toimage
for image generation (default)app.gemini.model
: Gemini model for image generation (e.g.,gemini-2.5-flash-image
)app.template.path
: Path to the template image file to useapp.file1.path
: Path to the first additional image (e.g., conference logo)app.file2.path
: Path to the second additional image (e.g., speaker photo)app.template.formats
: Supported image formats (png, jpg, jpeg, gif, webp)
app.media.type
: Set tovideo
for video generationapp.gemini.model.veo
: Veo model for video generation (e.g.,veo-3.0-fast-generate-001
)app.video.ratio
: Video aspect ratio (e.g.,16:9
,9:16
,1:1
)app.video.resolution
: Video resolution (e.g.,1080p
,720p
,4k
)app.template.path
: Path to the base image for video generation
-
Place your template images in the
images/
directory -
Configure the template path in
application.properties
:# For image generation app.media.type=image app.template.path=images/my-custom-template.png app.file1.path=images/logo.png app.file2.path=images/speaker-photo.jpg # For video generation app.media.type=video app.template.path=images/base-image.png app.video.ratio=16:9 app.video.resolution=1080p
-
Or pass it as a command-line parameter:
# Image generation java -jar target/quarkus-app/quarkus-run.jar \ -Dapp.media.type=image \ -Dapp.template.path=images/special-template.jpg \ -Dapp.file1.path=images/conference-logo.png \ -Dapp.file2.path=images/speaker.jpg # Video generation java -jar target/quarkus-app/quarkus-run.jar \ -Dapp.media.type=video \ -Dapp.template.path=images/base.png \ -Dapp.video.ratio=9:16 \ -Dapp.video.resolution=1080p
The application automatically detects and supports the following image formats:
- PNG (
.png
) - Recommended for templates with transparency - JPEG (
.jpg
,.jpeg
) - Good for photographic templates - GIF (
.gif
) - Supports animated templates - WebP (
.webp
) - Modern format with good compression
The application includes built-in template validation:
- Checks if the specified template file exists
- Falls back to the default template if the primary template is missing
- Provides clear error messages if no valid template is found
- Logs template usage for debugging
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
For support and questions:
- Create an issue in the GitLab repository
- Check the Google AI documentation
- Review the Quarkus guides
This project is licensed under the MIT License - see the LICENSE file for details.
- Jean-Philippe Baconnais (@jeanphi-baconnais)
Jean-Phi Baconnais |
Benjamin |