Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Generate Random Fractal Flame Wallpaper (BETA)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
gregcoit
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2002
Posts: 101

PostPosted: Sat Sep 10, 2005 1:09 am    Post subject: [HOWTO] Generate Random Fractal Flame Wallpaper (BETA) Reply with quote

After reading this ( https://forums.gentoo.org/viewtopic-t-328571-highlight-wallpaper+weather.html ) thread, I became interested in being able to generate fractal flames randomly and using them as my wallpaper automatically.

Here are a few examples (shrunk to 640x480 to reduce bandwidth):


There are 2 pretty easy ways to generate fractal flames from the linux command line, gimp ( http://gimp.org ) and flam3 ( http://flam3.com/ ). Since flam3's inmterface was a little more understandable to me I decided to play with it (FWIW, flam3's website seems to indicate that it's what gimp uses to generate flames).

The first step is to download and compile flam3 (sorry, no ebuild available yet).

Code:
wget http://flam3.com/flam3-2.6.tar.gz
tar xvzf flam3-2.6.tar.gz
cd flam3-2.6
./configure
make


Note that flam3 provides several applications:
    flam3-animate
    flam3-convert
    flam3-genome
    flam3-render


At this time, we're only using flam3-render.

Next step is to download the perl script I wrote:

Code:
wget http://gnugamesonline.com/wallpaper/create_flame.pl.txt
mv create_flame.pl.txt create_flame.pl


There will be some variable you will need to set. specifically where you placed flam3-render, size and background color of the image you want to render, and where you want to store the image.

What this script does is generates random numbers to fill in the xml file that flam3-render uses (more info on how flam3-render works and what the xml file looks like canbe found here: http://flam3.com/flame.pdf or in the source code README.txt). It then passes the xml file to flam3-render and tells kde to use that new image (images are stored in timestamp format because dcop will ignore the change wallpaper command unless the file name is different than the existing wallpaper).

Now we are ready to test the program:

Code:
chmod 755 create_flame.pl
./create_flame.pl


And your wallpaper should be a randomly generated fractal flame.

As of yet, I have had no luck getting cron to run this script (it renders an image, and dcop seems to run, but the wallpaper isn't updated)

All comments and suggestions are welcome, especially information on generating cleaner fractal flames (mine have more *noise* than I would like), but you are also welcome to criticize my rudimentary perl skills. :)

TO DO:
    add options for other window managers
    use XML modules to clean up the code
    add code to delete old images
    adjust values to remove noise

_________________
"Life would be so much easier if we could see the source code"
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Sun Sep 11, 2005 4:44 am    Post subject: Reply with quote

I set:
Code:
$wallpaper_update = "DISPLAY=:0.0 fbsetbg " . $image_location . " 4" ;

and it works from cron.

Only 1 in 20 of the images look inviting, though ... the rest are rather drab.
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
gregcoit
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2002
Posts: 101

PostPosted: Tue Sep 13, 2005 11:01 pm    Post subject: Reply with quote

Dlareh wrote:
I set:
Code:
$wallpaper_update = "DISPLAY=:0.0 fbsetbg " . $image_location . " 4" ;

and it works from cron.


Thanks - i'll try that!

Dlareh wrote:
Only 1 in 20 of the images look inviting, though ... the rest are rather drab.


Agreed. The trick will be to figure out what (mathmatically) makes for the more interesting flames, and then program in a weight towards those types.

I'll have an update to the script in a few days (probably friday afternoon) which will make this easier.

Greg
_________________
"Life would be so much easier if we could see the source code"
Back to top
View user's profile Send private message
tommy04
n00b
n00b


Joined: 09 Sep 2005
Posts: 16

PostPosted: Tue Sep 13, 2005 11:17 pm    Post subject: Reply with quote

EDIT 2: Got it to work!

Very nice script. Thanks!

(And it DOES work with xsetbg- just take out the trailing 4. This should work for any window manager that doesn't have an app that takes over the root window.)

EDIT 3: Okay, only problem is that xsetbg won't work with cron if you're setting a non-root background (I did su -c user "xsetbg /home/tommy/wallpaper.jpg" to test and it didn't work >_<).
Back to top
View user's profile Send private message
gregcoit
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2002
Posts: 101

PostPosted: Fri Sep 16, 2005 8:29 pm    Post subject: Reply with quote

tommy04 wrote:
(And it DOES work with xsetbg- just take out the trailing 4. This should work for any window manager that doesn't have an app that takes over the root window.)


Great - I'll add that to the script.

tommy04 wrote:
EDIT 3: Okay, only problem is that xsetbg won't work with cron if you're setting a non-root background (I did su -c user "xsetbg /home/tommy/wallpaper.jpg" to test and it didn't work >_<).


Yeah - same problem I was having. Did you try this with the crontab being the same user as the WM is run under?

An updated script will be uploaded in a few hours...

Greg
_________________
"Life would be so much easier if we could see the source code"
Back to top
View user's profile Send private message
gregcoit
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2002
Posts: 101

PostPosted: Fri Sep 30, 2005 7:15 pm    Post subject: Updated Reply with quote

gregcoit wrote:
An updated script will be uploaded in a few hours...


Okay, and updated script *was* uploaded a few hours after this post - but then I forgot to mention it here.

So. There's a new version of the script online script . It's got some more options and makes more interesting fractal flames. Please comment away on any ascpect of the script of it's results!

Thanks!

Greg
_________________
"Life would be so much easier if we could see the source code"
Back to top
View user's profile Send private message
otherdave
n00b
n00b


Joined: 27 Sep 2005
Posts: 23

PostPosted: Tue Oct 04, 2005 2:44 am    Post subject: Reply with quote

Awesome script!

I'm using GNOME so I had to turn off Nautilus icon drawing. Not sure if I like it, but I might run this script a few hundred times while I'm at work and pick out a few images I like.

Thanks for sharing!
Back to top
View user's profile Send private message
otherdave
n00b
n00b


Joined: 27 Sep 2005
Posts: 23

PostPosted: Tue Oct 04, 2005 12:46 pm    Post subject: Reply with quote

The script uses (0, 0, 0) as the background color. I switched the rendering to render to PNG instead of a JPG and now my background is transparent. While this is pretty cool if I want to put it on whatever background color, image, etc... it's tough to preview it like that :)

Any ideas how to fix this? Their PDF didn't mention anything specifically. I'm wondering if PDF rendering takes 4 elements: (0, 0, 0, 0) with one for the alpha channel?

I'll have to give this a try when I get home from work.
Back to top
View user's profile Send private message
gregcoit
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2002
Posts: 101

PostPosted: Fri Oct 07, 2005 7:19 pm    Post subject: Any luck with PNG? Reply with quote

otherdave wrote:
The script uses (0, 0, 0) as the background color. I switched the rendering to render to PNG instead of a JPG and now my background is transparent. While this is pretty cool if I want to put it on whatever background color, image, etc... it's tough to preview it like that :)

Any ideas how to fix this? Their PDF didn't mention anything specifically. I'm wondering if PNG rendering takes 4 elements: (0, 0, 0, 0) with one for the alpha channel?

I'll have to give this a try when I get home from work.


Any luck with this? I imagine PNG would be a very popular output type.

Greg
_________________
"Life would be so much easier if we could see the source code"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum