I was making a similar library (paired with a cli app) in Go a while back with some fun results -- it lead me down a rabbit hole trying to render animated gifs, which has interesting results depending on the terminal being used. I also implemented the resizing of the images to properly scale for the terminal as well. I never actually got around to uploading the repo, but will try to get around to that tonight.
Some videos of it in action: https://youtu.be/L2LTPKW6EPw https://youtu.be/b0CYZyuKLr8 https://youtu.be/_VnV96l5Xkc