atanunq / viu

Terminal image viewer with native support for iTerm and Kitty
MIT License
2.53k stars 56 forks source link

Added a cli argument to adjust gif playback rate. #53

Closed mmulet closed 3 years ago

mmulet commented 3 years ago

Hello! I think viu is great! I needed to adjust the frame-rate, so I modified the code to allow this. I'm just sharing my changes, use them if you want or don't, doesn't make a difference to me.

On a side note, there should be a way to read the frame rate from the .gif itself, but I don't use Rust daily and I don't know what the API is. Cheers!

mmulet commented 3 years ago

Found the API for .gif playback. In .gif's each frame encodes how long you should wait (in milliseconds to delay the frame). So now I default to that behavior, unless the user overrides it with --frame_rate argument. However, if the gif doesn't have delay information, it plays without a delay (as fast as possible). I don't know if this is desired behavior or not, it would be trivial to add a 30 ms delay, in the case of all delays being zero, so let me know.

mmulet commented 3 years ago

Sure no prob. I can do that later today.

atanunq commented 3 years ago

Great, thank you!