LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-24-2013, 06:35 PM   #1
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,240

Rep: Reputation: 196Reputation: 196
Automatically Generated Wallpapers


This is the thread in which you may publish your scripts generating wallpapers together with the sample results. It is for fun so have fun!

***

I wrote three versions of the script which generates six random wallpapers: three bright (gaussian, impulse, and laplacian), two halftone (multiplicative and poisson), and one dark (random). Each script is parametrized so you may experiment with the parameters values reaching different results. By default each script generates 1024◊768 wallpapers. Below are the scripts and the samples taken from the generated wallpapers.

AGW-1-1
AGW-1-1.png
Code:
#!/bin/bash

# AGW-1-1: creates six random wallpapers (it scales the image after drawing the lines)

# (C) w1k0 from LinuxQuestions.org (2013)

#
# CONFIGURATION SECTION BEGINS HERE
#

width=256               # both these parameters are multiplied by the scale
height=192              # (see: below)

square=8                # the size of the square (use: 4, 8, 16, 32, or 64)
color="lightgray"       # the color of the lines (use: white, lightgray, darkgray, gray, or black)

scale=4                 # the scale of the wallpaper (use: 1 for 100% scale)

#
# CONFIGURATION SECTION ENDS HERE
#

width_steps=$(($width/$square))
height_steps=$(($height/$square))

drawstr=""

for w in $(seq 0 $width_steps)
do
    W=$(($w*$square))
    drawstr="$drawstr M $W,0 L $W,$height"
done

for h in $(seq 0 $height_steps)
do
    H=$(($h*$square))
    drawstr="$drawstr M 0,$H L $width,$H"
done

scale=$(($scale*100))

for method in Gaussian Impulse Laplacian Multiplicative Poisson Random
do
    command="convert -size ${width}x${height} xc: -channel G +noise $method -separate +channel \
    -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
    -scale ${scale}% AGW-1-1-$method.png"
    echo $command
    echo
    eval $command
done
AGW-1-2
AGW-1-2.png
Code:
#!/bin/bash

# AGW-1-2: creates six random wallpapers (it scales the image before drawing the lines)

# (C) w1k0 from LinuxQuestions.org (2013)

#
# CONFIGURATION SECTION BEGINS HERE
#

width=256               # both these parameters are multiplied by the scale
height=192              # (see: below)

scale=4                 # the scale of the wallpaper (use: 1 for 100% scale)

square=4                # the size of the square (use: 4, 8, 16, 32, 64, 128, or 256)
color="lightgray"       # the color of the lines (use: white, lightgray, darkgray, gray, or black)

#
# CONFIGURATION SECTION ENDS HERE
#

width_steps=$(($width*$scale/$square))
height_steps=$(($height*$scale/$square))
total_width=$(($width*$scale))
total_height=$(($height*$scale))

drawstr=""

for w in $(seq 0 $width_steps)
do
    W=$(($w*$square))
    drawstr="$drawstr M $W,0 L $W,$total_height"
done

for h in $(seq 0 $height_steps)
do
    H=$(($h*square))
    drawstr="$drawstr M 0,$H L $total_width,$H"
done

scale=$(($scale*100))

for method in Gaussian Impulse Laplacian Multiplicative Poisson Random
do
    command="convert -size ${width}x${height} xc: -channel G +noise $method -separate +channel \
    -scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
    AGW-1-2-$method.png"
    echo $command
    echo
    eval $command
done
AGW-1-3
AGW-1-3.png
Code:
#!/bin/bash

# AGW-1-3: creates six random wallpapers (it scales the image twice)

# (C) w1k0 from LinuxQuestions.org (2013)

#
# CONFIGURATION SECTION BEGINS HERE
#

width=64                # both these parameters are multiplied by the scale two times
height=48               # (see: below)

initial_scale=8         # the scale of the wallpaper before drawing lines (use: 1 for 100% scale)

square=8                # the size of the square (use: 4, 8, 16, 32, or 64)
color="lightgray"       # the color of the lines (use: white, lightgray, darkgray, gray, or black)

final_scale=2           # the scale of the wallpaper after drawing lines (use: 1 for 100% scale)

#
# CONFIGURATION SECTION ENDS HERE
#

width_steps=$(($width*$initial_scale*$final_scale/$square))
height_steps=$(($height*$initial_scale*$final_scale/$square))

total_width=$(($width*$initial_scale*$final_scale))
total_height=$(($height*$initial_scale*$final_scale))

drawstr=""

for w in $(seq 0 $width_steps)
do
    W=$(($w*$square))
    drawstr="$drawstr M $W,0 L $W,$total_height"
done

for h in $(seq 0 $height_steps)
do
    H=$(($h*square))
    drawstr="$drawstr M 0,$H L $total_width,$H"
done

initial_scale=$(($initial_scale*100))
final_scale=$(($final_scale*100))

for method in Gaussian Impulse Laplacian Multiplicative Poisson Random
do
    command="convert -size ${width}x${height} xc: -channel G +noise $method -separate +channel \
    -scale ${initial_scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
    -scale ${final_scale}% AGW-1-3-$method.png"
    echo $command
    echo
    eval $command
done
 
Old 11-24-2013, 11:21 PM   #2
HarryStone
LQ Newbie
 
Registered: Nov 2013
Posts: 17

Rep: Reputation: Disabled
That's slick, thanks for posting this.
 
1 members found this post helpful.
Old 11-25-2013, 07:22 PM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,240

Original Poster
Rep: Reputation: 196Reputation: 196
Today I wrote the script which generates six random wallpapers with the reduced color spaces. As a result these wallpapers work better as the backgrounds. By default the script creates miniaturized wallpapers. To get full 1024◊768 wallpapers increase width to 256 and height to 192.

AGW-2
AGW-2.png
Code:
#!/bin/bash

# AGW-2: creates six random wallpapers with the reduced color spaces

# (C) w1k0 from LinuxQuestions.org (2013)

#
# CONFIGURATION SECTION BEGINS HERE
#

# to get 1024x768 wallpapers increase width to 256 and height to 192

width=64                # both these parameters are multiplied by the scale
height=48               # (see: below)

scale=4                 # the scale of the wallpaper (use: 1 for 100% scale)

square=4                # the size of the square (use: 4, 8, 16, 32, 64, 128, or 256)
color="gray"            # the color of the lines (use: white, lightgray, darkgray, gray, or black)

#
# CONFIGURATION SECTION ENDS HERE
#

width_steps=$(($width*$scale/$square))
height_steps=$(($height*$scale/$square))
total_width=$(($width*$scale))
total_height=$(($height*$scale))

drawstr=""

for w in $(seq 0 $width_steps)
do
    W=$(($w*$square))
    drawstr="$drawstr M $W,0 L $W,$total_height"
done

for h in $(seq 0 $height_steps)
do
    H=$(($h*square))
    drawstr="$drawstr M 0,$H L $total_width,$H"
done

scale=$(($scale*100))

command="convert -size ${width}x${height} xc: -channel G +noise Random -separate +channel \
-colors 2 -colorspace gray \
-scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
AGW-2-1.png"
echo $command
echo
eval $command

command="convert -size ${width}x${height} xc: -channel G +noise Random -separate +channel \
-colors 2 -level-colors black,gray \
-scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
AGW-2-2.png"
echo $command
echo
eval $command

command="convert -size ${width}x${height} xc: -channel G +noise Random -separate +channel \
-colors 2 -level-colors black,lightgray \
-scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
AGW-2-3.png"
echo $command
echo
eval $command

command="convert -size ${width}x${height} xc: -channel G +noise Random -separate +channel \
-colors 2 \
-scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
AGW-2-4.png"
echo $command
echo
eval $command

command="convert -size ${width}x${height} xc: -channel G +noise Random -separate +channel \
-colors 2 -level-colors gray,white \
-scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
AGW-2-5.png"
echo $command
echo
eval $command

command="convert -size ${width}x${height} xc: -channel G +noise Random -separate +channel \
-colors 2 -level-colors darkgray,white \
-scale ${scale}% -stroke $color -strokewidth 1 -draw \"stroke-opacity 1 path '$drawstr'\" \
AGW-2-6.png"
echo $command
echo
eval $command
 
Old 11-26-2013, 02:01 AM   #4
John VV
Guru
 
Registered: Aug 2005
Posts: 12,919

Rep: Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715
have a look at using
http://www.bottlenose.demon.co.uk/sh...tron/index.htm
a script can use that to create a image 1920x1080
 
1 members found this post helpful.
Old 11-26-2013, 01:58 PM   #5
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,240

Original Poster
Rep: Reputation: 196Reputation: 196
John VV,

Thank you for sharing here the information about Evolvotron. In fact it isnít a simple script but a complicated program and it doesnít generate the images from scratch but transforms the existing images. Of course it still may be interesting for some users.
 
Old 11-26-2013, 02:25 PM   #6
John VV
Guru
 
Registered: Aug 2005
Posts: 12,919

Rep: Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715
but a script can be used to run the terminal version to generate a image
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to STOP changing of wallpapers automatically on DHCP on Ubuntu OS naveen_cs321 Ubuntu 3 10-09-2013 01:57 PM
Xauth data not being generated automatically coiner Linux - Software 3 09-05-2012 08:07 AM
[SOLVED] Slackware64 13.37: 70-persistent-cd.rules not automatically generated Richard Cranium Slackware 4 06-04-2011 11:14 PM
Automatically Generated Includes In Httpd.conf bar338 Linux - Server 0 12-19-2009 10:56 AM
Please, Remove the automatically generated line in the Signatures john_walsh54 LQ Suggestions & Feedback 16 06-05-2005 12:34 PM


All times are GMT -5. The time now is 11:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration