LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Automatically Generated Wallpapers (https://www.linuxquestions.org/questions/programming-9/automatically-generated-wallpapers-4175485757/)

w1k0 11-24-2013 06:35 PM

Automatically Generated Wallpapers
 
3 Attachment(s)
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
Attachment 14047
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
Attachment 14048
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
Attachment 14049
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


HarryStone 11-24-2013 11:21 PM

That's slick, thanks for posting this.

w1k0 11-25-2013 07:22 PM

1 Attachment(s)
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
Attachment 14062
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


John VV 11-26-2013 02:01 AM

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

w1k0 11-26-2013 01:58 PM

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.

John VV 11-26-2013 02:25 PM

but a script can be used to run the terminal version to generate a image


All times are GMT -5. The time now is 01:44 AM.