LastCollage

[description] [files] [requirements] [installation] [usage] [tips] [contact] [last changes] [web version] [gallery]

Description

LastCollage is a bash script that generates a collage of album covers from your last.fm profile. It runs on linux and Mac and on Windows with cygwin.
Here is the kind of picture it produces:

(big version here).

It makes a really nice desktop wallpaper. Check out the gallery to see many other examples.

Inspiration: Gijsco's Last.fm Desktop Generator for the use of last.fm data, and Jamie Zawinski's webcollage, for the collage.

NEW: please check wallpaperfm.py, a new script which includes the collage and two more wallpapers (and is much faster) (and has less requirements).

Files

You need these 2 files (lastCollage and parse_pictures.xsl).
lastCollage [Show source]
parse_pictures.xsl [Show source]

Requirements

If you're on a Mac and have macports installed, run this before installing the script, to install wget and ImageMagick:
sudo port install wget
sudo port install imagemagick 
If you're on Windows with cygwin, you'll probably need to install wget, xsltproc and bc, since they don't seem to be there by default. Simply run setup.exe and select them for installation. You'll find wget in the 'Web' category, xlstproc in the 'Interpreters' category (as 'libxslt') and bc in the 'Utils' category (as 'bc the GNU numeric processing language and reverse Polish calculator').

Installation

Here is one way to install lastCollage from the command line:
mkdir lastCollage
cd lastCollage
wget http://ledazibao.free.fr/lastCollage/lastCollage
wget http://ledazibao.free.fr/lastCollage/parse_pictures.xsl
chmod a+x lastCollage
lastCollage is then run with ./lastCollage and will produce a jpg file.

For a limited period: the web version, no install necessary.

Usage

./lastCollage
will run the script with the default values:
I'll be using the following parameters:-
        (u) Username: Koant 
        (t) How far back: overall (should be one of '3month', '6month','12month' and 'overall')
        (n) Name of the picture: Koant.jpg
        (c) Size of the canvas: 1280x1024
        (f) Size of the final image: 1280x1024
        (a) Album size: 300 pixels
        (o) Album opacity: 80 (in [0 100]. 100 means no transparency)
        (g) Gradient size: 20 pixels (should be between 1 and half the album size)
        (O) Darkness of final image: 70 (in [0 100]. 0 makes the image completely black)
	(i) Number of iterations: 1
You can change the default values by passing the following parameters:
-u username
-t one of '3month', '6month', '12month', 'overall'
-n name of the picture
-c size of the canvas as WidthxHeight
-f size of the final image as WidthxHeight
-a album size in pixels
-o album opacity, in [0 100]. 100 means no transparency.
-g gradient size in pixels 
-O darkness of final image, in [0 100]. 0 makes the image completely black.
-i number of iterations, 1 by default.
For example, if you want to have quick try with a smaller final image, for example 640x480, and for the user RJ, use the following command. We use a smaller album size as well, say 150 pixels.
./lastCollage -u RJ -f 640x480 -a 150  
You need an internet connection, for the program to fetch your profile.
When it's finished, a jpg image (username.jpg by default) will contain the collage.
You should be able to use the script in a cron job. /usr/bin/gconftool -t str -s /desktop/gnome/background/picture_filename "yourpicture" will update the wallpaper in Gnome. (well, almost)

Tips

By default, the script uses a uniformly black background, unless the picture $imagename.jpg exists. In the latter case, this is used as a background. So if you think your collage looks a bit 'empty' the first time around (there're only 50 albums in the feed, and they don't cover the whole screen due to the overlap), run the script again; it'll look 'fuller' and nicer.
You can also use the '-i' switch to specify how many runs through the album list you want.
Note that '-i 2' is not equivalent to running lastCollage twice in a row, since the first batch is not darkened before applying the second one.

The canvas is the surface which the album covers are pasted on. By default, it has the same dimensions as the final image. If you want to have a black border around the collage, use a canvas that is smaller than the final image.
If on the other hand, you'd rather not have any borders, use a canvas bigger than the final image. It has the effect of generating the collage on a bigger surface and cropping the central part to produce the final image. A good dimension for the canvas in this case is final image size + album size; at a minimum, half of a cover is pasted on the final image.
Examples:
Canvas is smaller than final image Canvas is bigger than final image Canvas is smaller than final image on the y-axis,
and bigger than final image on the x-axis

Contact

You can contact me at http://www.last.fm/user/Koant or in the last.fm's forum thread. Comments, questions and suggestions welcome!

Last changes

Thu 15 May Tue 29 Apr Mon 31 Mar Sun 30 Mar Thu 27 March 2008 Mon 24 March 2008 Sun 23 March 2008 Thur 20 March 2008 Wed 19 March 2008