Create desktop wallpaper with Imagemagick

Imagemagick is a really awesome tool which few people really utilise mainly because it is a command line application. Creating Random Noise Images is one of the many cool features of Imagemagick.  Imagemagick recognises around 680 colors and we can make beautiful background images with individual or dual combinations of these colors . Check to see list of colors or if Imagemagick is installed through the command line convert -list color in terminal.

If Imagemagick is not installed install it via terminal sudo apt-get install imagemagick ( Ubuntu ) or through  Software Centre ( Ubuntu ) or Add/Remove Software ( Fedora ).

Colours are randomly selected from the list in color.txt file and wallpapers are made with convert command using these colors.


#to create wallpaper with Imagemagick

#to get the list of colors and save it in a folder
if [ -e /home/$USER/color.txt ];then
   convert -list color | cut -d "(" -f 1 | sed 's/rgb//g'| sed -n '6,$p' > /home/$USER/color.txt

#for selecting colors randomly 

select=$[ ( $RANDOM % 3 ) + 1 ]
num1=$[ ( $RANDOM % 680 ) + 1 ]
num2=$[ ( $RANDOM % 680 ) + 1 ]

color1=$(sed -n "${num1}p" /home/$USER/color.txt)

color2=$(sed -n "${num2}p" /home/$USER/color.txt)

if [ $select == 1 ];then
   convert -size 2000x1250  plasma:$color1 random.jpg
elif [ $select == 2 ];then
   convert -size 2000x1250  plasma:"$color1-$color2" random.jpg
   convert -size 2000x1250 plasma:fractal random.jpg


Running the script ones will create color.txt file ( where the list of colours  recognised my Imagemagick is stored for random selection) and image file random.jpg ( 2000x1250 pixels ) in your home directory.
Make random.jpg your desktop background. If not satisfied with background run the script again till you find background of your taste. As random.jpg file is replaced by the script the background will also change automatically. 

You can also try looping the script through a for loop . The script is named back in my system .So in terminal execute 

for (( i=0; i<35; i++ ));do
sleep 3

See 35 times your background change with really cool colour combinations !! Try it , it is really cool !!

If you want your background to be new everytime you loggin  place the script in Startup Applications  or by executing  the script through  /etc/rc.local 

click on image to see enlarged

 click on image to see enlarged

 click on image to see enlarged

 click on image to see enlarged

 click on image to see enlarged

To read more on backgrounds with Imagemagick please visit  and

Enjoy Linux !!

Dont know what to do with these codes ?? click here

1 comment:

  1. Well that's kinda friggin cool. Advantage bash indeed. Well done Sir.