Networking | Programming | Security | Linux | Computer Science | About

Save the output of a command as an image

To capture the output of a command in an image file, use the convert command from the ImageMagick software suite.

$ command | convert label:@- image.png

If you want to email a password to someone, but don't want it travel around the Internet in plain text, put it in an image.

When supplying the at sign (@) to label it tells convert to read input from the file following the at sign.

The dash says the "file" is coming from standard input.

If you want to create a simple image with some text you can supply a string to label.

$ echo "bob:changeme" | sudo chpasswd 
$ echo "bob:changeme" | convert label:@- password.png 
$ convert label:"bob:changeme" same-thing-different-way.png 
$ echo "Here's your password. Again." | mail -a passwd.png -s 'Password reset' $

Published on Sat 24 March 2001 by Lai Yahui in Linux with tag(s): linux image