Skip to content

Commit

Permalink
fix text location calculation using the full image size
Browse files Browse the repository at this point in the history
  • Loading branch information
BradLewis committed Jul 31, 2023
1 parent 04284d6 commit af9baef
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/generator/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (

func getTextOffset(dc *gg.Context, text string, displayOptions DisplayOptions) (float64, float64) {
width, height := dc.MeasureString(text)
imageSize := float64(dc.Width() - 20)
imageSize := float64(dc.Width()/displayOptions.Columns - 20)
switch displayOptions.TextLocation {
case constants.TOP_LEFT:
return 0, 0
Expand Down Expand Up @@ -114,7 +114,6 @@ func resizeImage(ctx context.Context, img *image.Image, width uint, height uint)
} else if int(width) == (*img).Bounds().Dx() && int(height) == (*img).Bounds().Dy() {
return img
} else if height == 0 {

height = uint(float64(width) * float64((*img).Bounds().Dy()) / float64((*img).Bounds().Dx()))
} else if width == 0 {
width = uint(float64(height) * float64((*img).Bounds().Dx()) / float64((*img).Bounds().Dy()))
Expand Down

0 comments on commit af9baef

Please sign in to comment.