asciinema / asciicast2gif

Generate GIF animations from asciicasts (asciinema recordings)
MIT License
1.2k stars 83 forks source link

number of columns is not respected #56

Closed ssbarnea closed 2 years ago

ssbarnea commented 5 years ago

it seem that asciicast2gif does not respect the custom number of columns required and fallbacks to 80 or similar value when tmux was involved.

I mention that the the same recording behavers normal when played using asciinema, this behaviour being seen only when converting to gif. Use of -c param seems to have no effect.

Both files can be found at https://github.com/pycontribs/rmux/tree/master/docs

The command used to build the gif was asciicast2gif -S 2 -w 160 movie.cast movie.gif and while the total number of columns of the gif is 160 you can see around the half of the animation that when tmux split window starts it is cropped to ~100 columns.

If you try to play the same recording, it will display correctly.

ku1ik commented 2 years ago

Altering the virtual terminal size with -w / -h options makes sense only when the output is line-based, simple printing, e.g. invoking commands in your shell and getting some results printed. Terminal multiplexers like tmux or screen (or "full-screen" applications like vim) handle terminal sizing on their own, and the recorded session will have all the cursor movement and resulting ascii line drawing fixed in a way which can't be altered post-factum. In other words, when recording tmux you need to ensure the terminal size is exactly like you want it to be displayed later, either in web player on when rendered to gif.