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 http://www.imagemagick.org/script/color.php 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 ).
-------------------------------------------------------------------------------------------------------------------------------------------------
HOW THIS SCRIPT WORKS:
Colours are randomly selected from the list in color.txt file and wallpapers are made with convert command using these colors.
-------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
#!/bin/bash
#to create wallpaper with Imagemagick
#to get the list of colors and save it in a folder
if [ -e /home/$USER/color.txt ];then
null=$null1
else
convert -list color | cut -d "(" -f 1 | sed 's/rgb//g'| sed -n '6,$p' > /home/$USER/color.txt
fi
#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
else
convert -size 2000x1250 plasma:fractal random.jpg
fi
-------------------------------------------------------------------------------------------
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
back
sleep 3
done
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
To read more on backgrounds with Imagemagick please visit http://www.imagemagick.org/Usage/backgrounds/ and http://www.imagemagick.org/Usage/canvas/#random
Enjoy Linux !!
Dont know what to do with these codes ?? click here
Well that's kinda friggin cool. Advantage bash indeed. Well done Sir.
ReplyDelete