charmbracelet / charmbracelet/x

x/mosaic rendering width does not bake in assumptions about character aspect ratio

Open
#705 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
314
Forks
94
Avg merge
3d 22h
Merged PRs (30d)
2

Description

### Description

Given the example in x/mosaic, if I were instead to remove the lines enforcing a height and width, the documentation states that the default here should be the base image height and width. Given the input image of a square --

Image

```golang
m := mosaic.New() // .Width(80).Height(40)
```

I would expect that the terminal render would still be a square. However, we see the actual output

Image

The fix seems to be manually changing the render width to twice the image size, as reported by `img.Bounds().Max.X`, i.e.

```golang
mosaic.New().Width(img.Bounds().Max.X * 2).Render(...)
```

Is this behavior expected?

### Version

_No response_

### Environment

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.