hc-image-gen
v0.0.3
Published
CLI for image editing with OpenAI
Readme
hc-image-gen
A CLI tool for generating and editing images using OpenAI's image editing API. This tool allows you to style images according to reference images using natural language prompts, with support for batch processing through templating.
Installation
npm install -g hc-image-genSetup
Configure your OpenAI API key:
ig configUsage
The tool uses YAML configuration files to define image editing requests. Use the edit command to process images:
ig edit request.yamlExamples
Simple Image Edit
Create a YAML file to edit a single image:
request:
background: transparent
size: "1024x1024"
quality: high
output_format: png
model: gpt-image-1
prompt: "Make this image look like a watercolor painting"
image:
- "/path/to/your/input-image.png"
result:
filename: "output/watercolor-style.png"Batch Processing with Templates
Use Mustache templating to generate multiple variations:
request:
background: transparent
size: "1024x1024"
quality: high
output_format: png
model: gpt-image-1
prompt: "Style this {{piece}} in a {{style}} art style"
image:
- "/path/to/chess/{{piece}}.png"
- "/path/to/reference/{{style}}-example.png"
data:
- piece: pawn
style: medieval
- piece: knight
style: futuristic
- piece: queen
style: abstract
result:
filename: "output/{{style}}-{{piece}}.png"This will generate three images:
output/medieval-pawn.pngoutput/futuristic-knight.pngoutput/abstract-queen.png
Commands
ig config- Set up your OpenAI API keyig edit <yaml-file>- Process images using the configuration fileig debug <yaml-file>- Preview the rendered configurations without making API calls
Output
For each generated image, the tool creates:
- The edited image file
- A JSON metadata file with request details and timestamps
Directories are created automatically if they don't exist.
