imagegen-cli
v1.0.0
Published
The Image Generator CLI is a command-line tool that allows users to generate AI-powered images by providing prompts. This tool supports saving API keys, generating images, and storing them locally. This project makes use of together ai API. it uses free f
Downloads
14
Readme
Image Generator CLI Documentation
The Image Generator CLI is a command-line tool that allows users to generate AI-powered images by providing prompts. This tool supports saving API keys, generating images, and storing them locally. This project makes use of together ai API. it uses free flux model from together ai to generate free images.
Installation
Prerequisites
If you already have Node.js installed:
- Ensure
npm
is available by running:node -v npm -v
- Then follow the Installation with Node.js section below.
- Ensure
If Node.js is not installed:
- You can download a node js and run it.
Installation with Node.js
Clone or Download the Repository:
git clone https://github.com/your-username/image-generator-cli.git cd image-generator-cli
Install the CLI Globally:
npm install -g .
Verify Installation:
imagegen --help
Usage
1. Set Your API Key
Before generating images, save your API key. This is a one-time setup.
imagegen set-api-key YOUR_API_KEY
- Replace
YOUR_API_KEY
with your actual API key, that you got from together.ai. - The key is stored securely in your home directory in a configuration file.
2. Generate an Image
Basic Usage
Provide a prompt for image generation:
imagegen generate -p "A futuristic cityscape at sunset"
Save Images to a Custom Directory
Specify a custom directory to save the image:
imagegen generate -p "A vibrant rainforest" -d ./my-images
- Default directory:
./PIctures
.
Commands
1. set-api-key
Stores your API key locally.
Syntax:
imagegen set-api-key <apiKey>
Example:
imagegen set-api-key sk-123abc456def
2. generate
Generates an image based on the provided prompt.
Syntax:
imagegen generate [options]
Options:
| Option | Description | Default |
|--------------------|-----------------------------------------------------|----------------------|
| -p, --prompt
| The text prompt for image generation | None (required) |
| -d, --directory
| Directory to save the generated image | ./generated-images
|
Examples:
- Generate an image with a specific prompt:
imagegen generate -p "A scenic mountain view"
- Generate an image and save it to a custom directory:
imagegen generate -p "A bustling futuristic city" -d ./my-outputs
Features
API Key Management:
- Stores API keys securely in a configuration file.
Image Generation:
- Supports customizable prompts to generate AI-powered images.
Customizable Output:
- Save images to any directory or use the default directory.
FAQ
Q1: Where is my API key stored?
Your API key is stored in a configuration file located at:
- Windows:
C:\Users\<username>\.image-generator-config.json
- macOS/Linux:
~/.image-generator-config.json
Q2: What happens if I don't specify a prompt?
The generate
command will fail because a prompt is required. Always include a prompt using -p
or --prompt
.
Contributing
Contributions are welcome! Feel free to fork the repository, make changes, and submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE
file for details.