# rsimg

A command-line tool that generates PNG images with diagonal lines and large centered text.

## Installation

```bash
cargo install rsimg
```

Or build from source:

```bash
cargo build --release
```

The binary is written to `target/release/rsimg`.

To install locally:

```bash
cargo install --path .
```

## Usage

```bash
rsimg <width> <height> <name> [--count N] [--color HEX]
rsimg --help
```

### Examples

```bash
# 200x300 image named ttt.png with text "ttt"
rsimg 200 300 ttt

# Generate 23 images: ttt_1.png … ttt_23.png
rsimg 200 300 ttt --count 23

# Red background with white text and lines (6-digit hex, no #)
rsimg 200 300 ttt --color ff0000

# Count and color together
rsimg 200 300 ttt --count 23 --color ffffff

# Show help
rsimg --help
```

## Arguments

| Argument | Required | Description |
|----------|----------|-------------|
| `width`  | Yes      | Image width in pixels |
| `height` | Yes      | Image height in pixels |
| `name`   | Yes      | Output filename prefix and text drawn at the center |

## Options

| Option | Default | Description |
|--------|---------|-------------|
| `--count N` | `1` | Number of images to generate. When greater than 1, files are named `{name}_{n}.png` |
| `--color HEX` | random | Background color as 6-digit hex without `#` (e.g. `ff0000`). Text and lines use the inverse color. A random background is used per image when omitted |
| `--help` | | Show help information |
| `--version` | | Show version information |

## Output

- Single image: `{name}.png`
- Multiple images: `{name}_1.png`, `{name}_2.png`, …

Images are saved to the current working directory.

## Image layout

- Background color from `--color` (random when omitted)
- Two diagonal lines forming an X (top-left to bottom-right, top-right to bottom-left)
- Large centered text (targeting at least 50% of the image area)
- The diagonal lines are split into segments so they do not overlap the text
- Text and lines use the inverse of the background color

## Color format

Provide background colors as six hexadecimal digits without a leading `#`:

- `ffffff` — white background, black text and lines
- `ff0000` — red background, cyan text and lines
- `000000` — black background, white text and lines

## License

MIT
