Skip to content

JoshCheek/animated-gif-in-the-terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Animated Gifs In The Terminal

What?

screencap

Try

Most of these loop forever, hold control and press C to interrupt them.

$ curl -sL http://bit.ly/1DRCK7q | ruby -    # owl small
$ curl -sL http://bit.ly/1EEKZ7v | ruby -    # owl sharp
$ curl -sL http://bit.ly/1JdRkxh | ruby -    # pacman small
$ curl -sL http://bit.ly/1HhjojP | ruby -    # pacman big
$ curl -sL http://bit.ly/1H3EUmQ | ruby -    # pony sharp
$ curl -sL http://bit.ly/1QJs83R | ruby -    # pony small
$ curl -sL http://bit.ly/1KK1GD9 | ruby -    # nyan cat
$ curl -sL http://bit.ly/1A0iNjU | ruby -    # kitten

Install

$ brew install imagemagick               # C dependency for reading gifs
$ bundle                                 # Get the Ruby dependencies
$ rspec                                  # Run the tests
$ bin/gif2rb examples/nyan.gif | ruby -  # Run the binary

Run

# see all options
$ bin/gif2rb -h

# run the owl
$ bin/gif2rb examples/owl.gif | ruby -

# run the kitten with highest quality pixels
$ bin/gif2rb examples/kitten.gif -s sharp | ruby -

ImageMagick

# Turn the white bg to transparent
convert pony.gif -alpha set -channel RGBA -fuzz '20%' -fill none -floodfill +0+0 black pony2.gif

# Crop the unused space (WxH+X+Y)
convert pony.gif -crop 88x80+34+40 pony4.gif

# Trim bounds (didn't work)
# convert anim_bgnd.gif -layers TrimBounds anim_trim_bounds.gif

# Extract frames from the animation
# convert pony.gif -scene 1 +adjoin frame_%03d.gif

# Okay, in the end, this is what I actually went with
convert pony.gif -crop 88x80+34+40 +repage -scale 50% pony4.gif

# Fixing disposal and alpha for pacman, scaling down, cropping the border (still doing this by trial and error >.<
$ convert -dispose Previous pacman.gif \
          -alpha set                   \
          -channel RGBA                \
          -fuzz '20%'                  \
          -fill none                   \
          -floodfill +0+0 black        \
          -scale 20%                   \
          -crop 100%x25+0+25 +repage   \
          pacman3.gif

# deleting frames we don't want
$ convert examples/nyan.gif -delete 5-8 -scale 11% examples/nyan.gif

Steal

wtfpl.

About

Animated Gifs in the terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages