If you want to be able to specify a resolution, change image() as follows:convert "$1" -resize "$2" txt:-...

This one-liner has ImageMagick resize and convert the image into a list of pixel data, which are filtered and piped into inline python ( UPDATE: now without python! ) as a raw list of x,y r,g,b where rgb values are mapped to a terminal color space and then rendered into a string of tput and echo commands, which are finally executed by bash. Note that this violates every conceived notion of efficiency, practicality, readability and maintainability. If you have mission-critical terminal imaging needs, the caca-utils package can probably help.

On OSX, if you use a higher resolution (passing 80 to convert), the sheer number of commands piped to bash may cause a segfault. In that case you need to increase the stack size (ulimit -s 32768) for the session. This issue does not occur on Linux for me even though the default ulimit parameters are the same.
For layered gifs, pass -layers flatten to convert.

I am not responsible if you get fired for using this to dynamically change your boss' MOTD to questionable content.

The colors, which are the 'web-safe' colors, can be viewed here without ImageMagick: