This Quarkus project uses Gemini and google-genai library to generate images from templates. This allows us to save time for our social network communication.
β οΈ 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 Generation: Creates images from pre-configured templates for blog posts and conference speakers
- π₯ Video Generation: Generate videos with Veo models
- π» Picocli CLI: Rich command-line interface with comprehensive options
- π Post Generation: Generate LinkedIn & Bluesky posts
- π― Multiple Templates: Support for single and dual-author/speaker templates
- 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-hereOption B: Configuration File
# Edit src/main/resources/application.properties google.ai.api.key=your-api-key-here -
Build the project
mvn clean compile
The application provides several pre-configured templates for different use cases:
-
generate-image-blog-post- Generate an image for a blog post (single author)- Fields:
NAME,TITLE,PHOTO
- Fields:
-
generate-image-2-blog-post- Generate an image for a blog post with 2 authors- Fields:
NAME,NAME2,TITLE,PHOTO,PHOTO2
- Fields:
-
generate-image-speaker-event- Generate an image to announce a speaker for a conference- Fields:
NAME,TITLE,CONF_PHOTO,PHOTO
- Fields:
-
generate-image-2-speaker-event- Generate an image to announce a talk with 2 speakers- Fields:
NAME,NAME2,TITLE,PHOTO,PHOTO2,CONF_PHOTO
- Fields:
generate-video-speaker-event- Generate a video to announce a speaker for a conference
generate-post-speaker-event- Generate LinkedIn & Bluesky posts
Quick examples:
# Show help
mvn quarkus:dev -Dquarkus.args="--help"
# Generate image for a blog post (single author)
mvn quarkus:dev -Dquarkus.args="image --template-name generate-image-blog-post --title 'Introduction to DuckDB' --name 'John Doe' --photo images/people/john-doe.png -o output.png"
# Generate image for a blog post (2 authors)
mvn quarkus:dev -Dquarkus.args="image --template-name generate-image-2-blog-post --title 'Exploring Firebase Studio' --name 'Alice Smith' --name2 'Bob Johnson' --photo images/people/alice.png --photo2 images/people/bob.png -o output.png"
# Generate image for a conference speaker
mvn quarkus:dev -Dquarkus.args="image --template-name generate-image-speaker-event --title 'My Great Talk' --name 'Speaker Name' --photo images/people/speaker.png --conf-photo images/logos/conference.png -o output.png"
# Generate image for a conference with 2 speakers
mvn quarkus:dev -Dquarkus.args="image --template-name generate-image-2-speaker-event --title 'Firebase Studio' --name 'Benjamin Bourgeois' --name2 'Jean-Phi Baconnais' --photo images/people/benjamin-bourgeois.png --photo2 images/people/jeanphi-baconnais.png --conf-photo images/logos/conference.png -o output.png"Development Mode (with hot reload):
mvn quarkus:devProduction mode:
# Build
mvn clean package
# Run
java -jar target/quarkus-app/quarkus-run.jar --help
# Example: Generate image for a speaker event
java -jar target/quarkus-app/quarkus-run.jar image --template-name generate-image-speaker-event --title "My Great Talk" --name "Speaker Name" --photo images/people/speaker-photo.png --conf-photo images/logos/conference.png -o output.pngThe 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.0-flash-exp
app.gemini.model.veo=veo-2.0
app.result.filename=gemini-generation-image.png
# Video Generation Configuration
app.video.ratio=16:9
app.video.resolution=1080p
# Quarkus Configuration
quarkus.http.port=8080
quarkus.log.level=INFOgoogle.ai.api.key: Your Google AI API key (required)app.gemini.model: Gemini model for image generation (default:gemini-2.0-flash-exp)app.gemini.model.veo: Veo model for video generation (default:veo-2.0)app.result.filename: Default output filename for generated imagesapp.video.ratio: Video aspect ratio (e.g.,16:9,9:16,1:1)app.video.resolution: Video resolution (e.g.,1080p,720p,4k)
Templates are defined in src/main/resources/templates.json. Each template specifies:
- name: Unique identifier for the template
- description: Human-readable description
- type: Template type (
IMAGE,VIDEO, orPOST) - template: Path to the template image file
- fields: Required fields for the template
- prompt: AI prompt used to generate the content
To add a new template, edit templates.json and add a corresponding handler in GenerateImageCommand.java.
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
- 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 |