vhs icon indicating copy to clipboard operation
vhs copied to clipboard

Hidden minimum values for sizes

Open Vortelf opened this issue 3 years ago • 2 comments

Using version 0.1.1.

The set Width and Height are positive, but probably not enough for the app to create a gif. The error is misleading.

➜ ./vhs shrug.tape
File: shrug.tape
Output .gif shrug.gif
Set FontSize 40
Set FontFamily Comic Mono
Set Width 300
Set Height 100
panic: {-32602 Width and height values must be positive, not greater than 10000000 }

goroutine 1 [running]:
github.com/go-rod/rod/lib/utils.glob..func2({0xd9ade0?, 0xc0002c6690?})
        /home/runner/go/pkg/mod/github.com/go-rod/[email protected]/lib/utils/utils.go:60 +0x25
github.com/go-rod/rod.genE.func1({0xc00011eda0?, 0x52fb0d?, 0x530b05?})
        /home/runner/go/pkg/mod/github.com/go-rod/[email protected]/must.go:36 +0x5a
github.com/go-rod/rod.(*Page).MustSetViewport(0xc000160370, 0x1?, 0x1?, 0x2?, 0x0?)
        /home/runner/go/pkg/mod/github.com/go-rod/[email protected]/must.go:307 +0xd8
main.(*VHS).Setup(0xc0004645c0)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/vhs.go:91 +0x66
main.Evaluate({0xc0005a8000, 0x863}, {0x1454480, 0xc000132008}, {0x0, 0x0, 0x0?})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/evaluator.go:48 +0x3fd
main.glob..func1(0x1a1b320?, {0xc0007356f0, 0x1, 0x1?})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/main.go:60 +0x16d
github.com/spf13/cobra.(*Command).execute(0x1a1b320, {0xc000138010, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x1a1b320)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1040 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
main.main()
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/main.go:135 +0x25

Working with wider sizes.

➜ ./vhs shrug.tape
File: shrug.tape
Output .gif shrug.gif
Set FontSize 40
Set FontFamily Comic Mono
Set Width 600
Set Height 200
Type ¯\_(ツ)_/¯
Space 10
Sleep 5s
Creating GIF...

Vortelf avatar Oct 28 '22 20:10 Vortelf

Ah yeah, this has to do with the Padding, great catch.

maaslalani avatar Oct 28 '22 20:10 maaslalani

We subtract 2 * Padding from the width and height so the height would be negative in this case. I will fix!

To fix this on your end you can:

Set Padding 10

I'll also ensure that the numbers cannot be negative on VHS' side.

maaslalani avatar Oct 28 '22 20:10 maaslalani