ImageGenTool 1.1.0
dotnet tool install --global ImageGenTool --version 1.1.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local ImageGenTool --version 1.1.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ImageGenTool&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package ImageGenTool --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ImageGenTool
A .NET global tool for generating images using Google's Gemini API.
Features
- 🎨 Generate images from text prompts using Google's Gemini API
- 🚀 Easy-to-use command line interface
- 📦 Packaged as a .NET global tool
- 🔧 Built with .NET 8 and C#
Installation
From NuGet (when published)
dotnet tool install --global ImageGenTool
From Source
git clone https://github.com/Sidoine/ImageGenTool.git
cd ImageGenTool
dotnet pack
dotnet tool install --global --add-source ./bin/Debug ImageGenTool
Usage
imagegen --prompt "Your image description" --output "path/to/output.png" --api-key "your-gemini-api-key" --size "1024x1024"
Options
-p, --prompt
(Required): The text prompt to generate an image from-o, --output
(Required): The output path where the generated image will be saved-k, --api-key
(Required): Your Google Gemini API key-s, --size
(Optional): Image dimensions in WIDTHxHEIGHT format (e.g., 1024x1024, 512x768). Default is 1024x1024-h, --help
: Show help information--version
: Show version information
Examples
# Generate a landscape image with default size (1024x1024)
imagegen -p "A serene mountain landscape at sunset" -o "./sunset.png" -k "your-api-key"
# Generate an abstract image with custom dimensions
imagegen -p "Abstract geometric patterns in blue and gold" -o "./abstract.png" -k "your-api-key" --size "512x768"
# Generate a portrait with square dimensions
imagegen -p "Portrait of a friendly robot" -o "./robot.png" -k "your-api-key" -s "1024x1024"
# Generate a wide landscape image
imagegen -p "Panoramic ocean sunset" -o "./ocean.png" -k "your-api-key" --size "1920x1080"
Getting a Gemini API Key
- Visit the Google AI Studio
- Sign in with your Google account
- Create a new API key
- Copy the API key and use it with the
--api-key
parameter
Image Dimensions
The --size
option allows you to specify custom image dimensions:
- Format:
WIDTHxHEIGHT
(case-insensitive, e.g.,1024x1024
or1024X1024
) - Default:
1024x1024
if not specified - Limits: Width and height must be between 1 and 4096 pixels
- Common sizes:
512x512
- Small square image1024x1024
- Standard square image (default)1920x1080
- Full HD landscape1080x1920
- Full HD portrait512x768
- Portrait aspect ratio768x512
- Landscape aspect ratio
The dimensions are communicated to the Gemini API as part of the prompt to help generate images at the requested resolution.
Development
Prerequisites
- .NET 8.0 SDK or later
- A Google Gemini API key for testing
Building
dotnet build
Running from Source
dotnet run -- --prompt "test prompt" --output "./test.png" --api-key "your-key" --size "1024x1024"
Packaging
dotnet pack
Architecture
The tool is built with:
- System.CommandLine: Modern command line parsing
- HttpClient: HTTP communication with the Gemini API
- System.Text.Json: JSON serialization for API requests
- .NET 8: Latest .NET framework with native AOT support
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions:
- Check the existing GitHub Issues
- Create a new issue with detailed information about your problem
- Include the command you ran and any error messages
Roadmap
- Integration with actual Gemini image generation API when available
- Support for custom image dimensions via --size option
- Support for different image formats (PNG, JPEG, WebP)
- Batch processing of multiple prompts
- Configuration file support
- Advanced prompt templating
- Progress indicators for long-running operations
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.