imjen
v0.0.8
Published
Imjen is a command-line tool for generating AI-powered images using the Replicate API. It's optimized for creating minimalistic flat vector icons and other images with customizable prompts and dimensions.
Readme
Imjen - AI Image Generator
Imjen is a command-line tool for generating AI-powered images using the Replicate API. It's optimized for creating minimalistic flat vector icons and other images with customizable prompts and dimensions.
Quick Start with npx
You can run Imjen directly without installation using npx:
npx imjenPrerequisites
- Replicate API Token: You need a Replicate API token to use this tool. Get one at replicate.com
- Node.js: Required for npx execution
Setup
Set your API token (choose one method):
- Environment variable:
export REPLICATE_API_TOKEN=your_token_here - Or add it to your configuration file (see Configuration section)
- Environment variable:
Run the tool:
npx imjen
On first run, Imjen will automatically create a configuration file (imjen.config.jsonc) with example settings.
Configuration
Imjen uses a imjen.config.jsonc file for configuration. Here's the structure:
{
// Optional: Set API token in config instead of environment
// "REPLICATE_API_TOKEN": "your_token_here",
// Default image model (Stability AI SDXL)
"imageModel": "stability-ai/sdxl",
// Display target optimization
"displayTarget": "browser",
// Default dimensions
"width": 512,
"height": 512,
// Generate multiple images
"images": [
{
"description": "Compass Rose for navigation",
"promptArg": "minimal flat compass rose icon"
},
{
"description": "Wind Direction Arrow",
"promptArg": "minimal arrow icon, wind direction, vector style",
"width": 256,
"height": 256
}
]
}Configuration Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| REPLICATE_API_TOKEN | string | - | Your Replicate API token |
| imageModel | string | "stability-ai/sdxl" | Replicate model to use |
| displayTarget | string | "browser" | Target display environment |
| width | number | 512 | Image width in pixels |
| height | number | 512 | Image height in pixels |
| promptArg | string | - | Custom prompt (overrides default) |
| description | string | - | Description for the image |
| images | array | - | Array of image configurations for batch generation |
Usage Examples
Single Image Generation
For single image generation, configure the root level options:
{
"imageModel": "stability-ai/sdxl",
"description": "My custom icon",
"promptArg": "minimalist settings gear icon",
"width": 256,
"height": 256
}Multiple Images (Batch Generation)
Use the images array for generating multiple images:
{
"imageModel": "stability-ai/sdxl",
"width": 512,
"height": 512,
"images": [
{
"description": "Home Icon",
"promptArg": "minimal house icon, flat design"
},
{
"description": "User Profile Icon",
"promptArg": "minimal user profile icon",
"width": 64,
"height": 64
},
{
"description": "Search Icon",
"promptArg": "minimal magnifying glass icon"
}
]
}Environment Variables
Set your API token as an environment variable:
# Linux/macOS
export REPLICATE_API_TOKEN=your_token_here
npx imjen
# Windows
set REPLICATE_API_TOKEN=your_token_here
npx imjenDefault Prompt
If no promptArg is specified, Imjen uses an optimized default prompt:
minimalistic flat vector icon. crisp geometry. metal frame with subtle bevel. pure white lines on a solid #202020 background. optimized for [width]×[height] UI useThis default is designed to create clean, professional icons suitable for user interfaces.
Output
- Generated images are saved as PNG files in the current directory
- Default filename:
generated_image.png(single image mode) - Batch mode: Files are named based on the configuration order
- Success/error messages are displayed in the console
Troubleshooting
Common Issues
"REPLICATE_API_TOKEN is not set"
- Set the token as an environment variable or in your config file
- Get a token from replicate.com
"Error generating image"
- Check your internet connection
- Verify your API token is valid
- Ensure the specified model exists on Replicate
Configuration file not found
- Run
npx imjenonce to auto-generate the example configuration - Manually create
imjen.config.jsoncin your project directory
- Run
Models
Imjen supports any image generation model available on Replicate. Popular options include:
stability-ai/sdxl(default) - High-quality general purposestability-ai/stable-diffusion- Classic Stable Diffusionlucataco/sdxl-lightning-4step- Fast generation
Contributing
This project is built with Deno and TypeScript. The source code is available on the project repository.
License
See the project repository for license information.
