Next: , Previous: Make your text executable, Up: Using avatarsay


3.4 Using a different avatar image

Up to now you have always seen the same avatar — a gnu. Maybe you don't like gnus or what you want the avatar to say doesn't fit the GNU-project. — Well, that is just the default avatar. You can exchange it.

There are different methods to exchange the avatar for avatarsay:

You can change it globally for any use of avatarsay. This can be done either with an environment variable or you can use a system-wide configuration file.

Well, first you might want to try the environment variable. That is simple. The variable is called AVATARIMAGE. So with the GNU bash you can set this variable like this: ‘export AVATARIMAGE=/usr/local/share/pixmaps/myavatar.bmp’. Important: You should always use the full path!

If you want to use a configuration file, create a file named /etc/avatarsay and put something like in this example into it:

     AVATARIMAGE=/usr/local/share/pixmaps/myavatar.bmp

If you write a text you want to be shown by avatarsay, you can change the avatar-image on a text-by-text basis, using a command in the text-file. This is explained in Commands for avatarsay.

Which file-formats AKFAvatar supports depends on which libraries you have installed. Uncompressed BMP images are always supported.

3.4.1 Transparent avatar background

The avatar-image should have a transparent background of course. Well, most image formats don't support transparency at all. Therefore AKFAvatar has a trick. If the avatar-image has no transparency, then it looks up the first color in the image, that is the color in the upper left corner, and defines this color to be transparent. So when you prepare an image as replacement for the avatar, make sure the upper left corner is “empty” and make sure to choose a background color, which doesn't appear in the part of the image which is meant to be visible. Also make sure, that the background is “flat” with only one single color without any variations. Because of this requirement the JPEG format is not appropriate, you cannot get a really flat background in that format.

When you can use image formats which support transparency, then use it. AKFAvatar will not interfere with it then. Note however that the trick explained above is always used when the image has no transparency, independent from the question, whether the image format could have transparency.