Metadata-Version: 2.4
Name: image-gen-cli
Version: 0.1.0
Summary: Command-line tool for generating images via the OpenAI API.
Project-URL: Homepage, https://github.com/bwbensonjr/image-gen-cli
Project-URL: Repository, https://github.com/bwbensonjr/image-gen-cli
Project-URL: Issues, https://github.com/bwbensonjr/image-gen-cli/issues
Author-email: Brent Benson <bwbensonjr@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: cli,gpt-image,image-generation,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Requires-Dist: openai>=2.34.0
Description-Content-Type: text/markdown

# Image Generation CLI 

A command line interface for generating images. The intial focus will
be on using the OpenAI API and `gpt-image-2`.

## Install

Install with [`uv`](https://docs.astral.sh/uv/) so `image-gen` is
available on your `PATH`. From a clone of this repository:

```sh
uv tool install --editable .
```

Or install directly from GitHub:

```sh
uv tool install git+https://github.com/bwbensonjr/image-gen-cli
```

`uv` places the launcher in its tool-bin directory (typically
`~/.local/bin`). If `image-gen` is not found after install, run `uv
tool update-shell` once and restart your shell, or check the location
with `uv tool dir --bin`.

`OPENAI_API_KEY` (and optionally `OPENAI_BASE_URL`) must be set in
your shell environment when invoking `image-gen`.

To upgrade after pulling new commits (non-editable installs):

```sh
uv tool upgrade image-gen-cli
```

## Behavior 

- Accepts an overall prompt describing what is wanted 
- Optionally it can accept other inputs including
  - Markdown or text files 
  - Example images
- An output file name specification (defaults to "output-image")
- The output is one or more images with names like
  "output-image-1.png" using the output file name spec.

## Technical Guidelines 

- Use OpenAI Python API which will use environment variables for
  OpenAI key and base URL.
- Use Python `argparse`.
- Use clig.dev command line guidelines cached locally as
  [`docs/cli_guidelines.md`](docs/cli_guidelines.md).
  
## OpenAI `gpt-image-2` Use

The recommendation for using `gpt-image-2` from the OpenAI API is
shown in this example:

```python
prompt = "Generate an image of Otter hugging a Penguin"
output_file = "image_output.png"
client = OpenAI() 
response = client.responses.create(
    model="gpt-5.5",
    input=prompt,
    tools=[{"type": "image_generation"}],
)
# Save the image to a file
image_data = [
    output.result
    for output in response.output
    if output.type == "image_generation_call"
]
if image_data:
    image_base64 = image_data[0]
    with open(output_file, "wb") as f:
        f.write(base64.b64decode(image_base64))
```

