🐛 Bug: Image.new size parameter uses (height, width) but PIL expects (width, height)
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Description
In `macarons/image_text.py` line 82:
```python
def generate_datapoint(height, width) -> Datapoint:
...
image = Image.new(mode='RGB', size=(height, width), color=color_list[1])
```
PIL's `Image.new()` expects `size=(width, height)`, but the code passes `(height, width)`. This means images are transposed — a 224x448 request would create a 448x224 image.
Similarly in the circle positioning:
```python
center = (
random.randint(radius, height - radius), # should be width
random.randint(radius, width - radius), # should be height
)
```
## File & Line
- `macarons/image_text.py`, lines 82, 85-88
## Why It Matters
For square images (the default 224x224) this doesn't matter, but for non-square images the output is wrong.
## Suggested Fix
```python
image = Image.new(mode='RGB', size=(width, height), color=color_list[1])
center = (
random.randint(radius, width - radius),
random.randint(radius, height - radius),
)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Open macarons/image_text.py and inspect generate_datapoint around lines 82-88. Verify the non-square image size and circle center coordinates against PIL's width-first convention; done means a 224x448 request produces the requested dimensions and positions the circle within them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100