Hacker News new | past | comments | ask | show | jobs | submit login

Really nice feature for the cli. The generated images could get a lot of more optimized though. The example.gif file ~2.5 MiB large, uses 100 ms frames and each frame updates the whole area. Some optimization suggestions:

* Use variable length frames * Only update areas that change between frames

For apng: * Use a palette, it can even handle 4 bits per channel palettes which could be enough for terminals.

Maybe these are all not necessary, a naive "gifsicle --optimize" reduced example.gif's size to ~150 KiB. It didn't remove frames though.




I agree with the gif optimization. It's on the todo list. The most important part is actually the x and y offsets for each frame, like you said: the damage to the image. It should be possible since ttystudio uses a blessed terminal cell buffer, which already has some code that could be borrowed for damage checks between frames.

The APNGs already use a palette (3). RGBA (6) is opt-in only. Although, it should probably just be RGB if people want to use it since the alpha is useless for terminal recordings anyway.

The only reason the --rgba option exists is because I ended up OOMing the process once or twice when compiling palettes for huge animations (1000s of frames) - this is before palette generation was optimized more.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: