Mic WrightReporter, TNW
Mic Wright is a journalist specialising in technology, music and popular culture. He lives in Dublin. He is on Twitter at @brokenbottleboy. Mic Wright is a journalist specialising in technology, music and popular culture. He lives in Dublin. He is on Twitter at @brokenbottleboy.
The Rickroll is still one of the Web’s purest troll moves. And now there’s an easy way to bring that Astley action to the terminal.
London-based developer Radek Pazdera has outlined a way to display images in terminal that uses just nine lines of Ruby.
Of course, you can use it for noble acts, like sharing a lovely picture of Pikachu, but deploying it for the dark arts is even better.
Pazdera started by combining two gems – rmagick (to read the images) and tco (to map pixels from RGB to the extended terminal color palette.)
He then extended the original code to create a new gem called catpix, which includes automatic image downsizing to take account of the width of the terminal window, centring, and the ability to add custom background colors.
As Pazdera notes in his post “people won’t fall for your Rickrolls as easily nowadays” so why not take to the terminal to trick your developer friends?
In the ever growing universe of Rickroll tactics, this might just be my new favorite. For full details, check out his post and the full API description here.
➤ Printing images in the terminal with 9 lines of Ruby [Radek.io]
Read next: Done with Cards Against Humanity? Squib is a version of Ruby for coding your own card games
Get the TNW newsletter
Get the most important tech news in your inbox each week.