# table-to-image

Convert pandas DataFrame tables to PNG images.

## Installation

```bash
pip install table-to-image
```

## Usage

### As a Python Library

```python
import pandas as pd
from table_to_image import render

# Create a DataFrame
df = pd.DataFrame({
    'Name': ['Alice', 'Bob', 'Charlie'],
    'Age': [25, 30, 35],
    'City': ['NYC', 'LA', 'Chicago']
})

# Convert to image
render(df, 'output.png')

# With custom options
render(df, 'output.png', font_size=16, header_bg_color=(255, 0, 0))
```

### Using the Class

```python
import pandas as pd
from table_to_image import DataFrameToImage

df = pd.DataFrame({'A': [1, 2], 'B': ['x', 'y']})

converter = DataFrameToImage(font_size=18, header_bg_color=(0, 128, 0))
converter.convert(df, 'table.png')
```

### CLI

```bash
# Convert CSV to PNG
table-to-image input.csv output.png

# Convert with custom font size
table-to-image input.csv output.png --size 20

# Convert Excel file
table-to-image data.xlsx output.png
```

## Options

| Option | Description | Default |
|--------|-------------|---------|
| `font_size` | Font size for text | 14 |
| `header_bg_color` | Header background color (RGB tuple) | (70, 130, 180) |
| `header_text_color` | Header text color (RGB tuple) | (255, 255, 255) |
| `cell_bg_color` | Cell background color (RGB tuple) | (255, 255, 255) |
| `cell_text_color` | Cell text color (RGB tuple) | (0, 0, 0) |
| `margin` | Margin around the table | 10 |

## License

MIT
