Adding captions to images with Python

So I wanted to add captions to a set of images and wrote some lines of Python. Python has some cool image libraries so the job was real easy. Have never used Python before except to write some kindergarten-level programs, so this may not be the best way to code the thing. But it does the job.

	import Image, ImageDraw, ImageFont, os

	if os.path.exists(pathz) and os.path.isdir(pathz):
		for name in os.listdir(pathz):
			print name
			im =
			d = ImageDraw.Draw(im)
			f = ImageFont.truetype("Arial.ttf", 16)
			d.text((4,0), namez, font=f)
		print "Directory not found"

It scans the given images directory and adds the file name sans extension as a caption, as shown below:

After adding the caption

Cruncher 2011

Although video games have become quite popular throughout the country, game development hasn’t come into mainstream in Sri Lanka. At least yet.

Cruncher 2011 aims to fill that gap by bringing in the creative and talented game programmers to light. Organized by the Young Members’ Section (YMS) of the Institute of Engineers of Sri Lanka (IESL), Cruncher 2011 is a game development competition that is open to all. The theme of the event is “Make Games, Make Global”, depicting its goal to pave way to the creative game developers to go global.

The competitors have the freedom to choose the type of game they want to develop, be it flash-based, non-flash 2D or 3D or storyboard. They can participate in the relevant subdivision: school, undergraduate or open. While the competitors will be awarded with attractive monetary prizes, they will also have the chance to participate in workshops with leading personalities from industry.

For more information, visit the competition’s website at Also join the Cruncher 2011 Facebook fan page to keep yourself updated.

Unity 2D

It was a bumpy ride. Unity, Gnome 2, LXDE and KDE. I tried almost all the popular environments (except XFCE, of which I had heard a lot of bad things).

KDE is perhaps the most attractive of these, but, sadly, it’s too heavy for a netbook. LXDE is light-weight indeed, but I had trouble running several applications with it. For example I couldn’t get gPodder to work no matter how hard I tried, and ibus was buggy.

I was going to test run Gnome 3 but @kau_mad said otherwise, so gave up. Which left me with two options: Unity and Gnome 2.

Unity was originally intended for netbooks. (This was the default environment in Ubuntu Netbook Remix, remember?) Stuff like global menu bars were made with small screens in mind. Unity works, but I found it a bit too sluggish. The solution? Unity-2D.

Unity-2D is a clone of Unity intended for low power computers like netbooks. While Unity has been written with GTK, Unity-2D uses the QT toolkit. It doesn’t require GPU acceleration , something which netbooks and other low-end machines can’t provide.

To install Unity-2D in Ubuntu 11.04, all you have to do is to install the package “unity-2d-default-settings” from the Software Center. Log out and choose Unity-2D as the desktop environment. The interface is quite similar to Unity, but it may not be as slick as Unity is. For example you won’t get those lovely fading effects. However it’s able to provide you with the maximum possible Unity experience.


The Kewl desktop environment – KDE

So I wanted to get some first hand experience on KDE. To install KDE in Ubuntu what you need is to install the kde-desktop (or  kde-netbook in my case) package from the repos. Once installed, log out and choose KDE before logging in.

KDE is the sex! There’s absolutely nothing so beautiful like it! Due to the restrictions in my netbook most of the effects won’t work for me, but still it looks marvelous. Sad to find that it’s being underrated in the FOSS world.

KDE desktop in my netbook

KDE’s however not so sweet with resources. The environment is heavy, perhaps even heavier than gnome. But I can’t make up my mind to leave it and go back to LXDE. The performance loss is quite worth the sacrifice, if you ask me.

Going Grayscale

It is said that using black and white (grayscale, in fact) screens help you focus and makes learning stuff easy. Today I suddenly had the urge to make my desktop go grayscale. Some googling led me to a piece of software called Grayscale Desktop (this is a Windows app). There’s no need to install, just double click on the Grayscale_fullscreen.exe, and there you go! To close the app you have to manually delete the process from the Task Manager.

P.S. The app eats CPU power a lot. At least that’s the case with my netbook. It’s good as long as what you’re doing is reading some book or browsing the web etc.

Moving to Lubuntu

The restrictions in my netbook made me convert my Ubuntu install into a Lubuntu. For this, you don’t need to manually download Lubuntu and install. All you need is to install Ubuntu first and run the command in this Psychocats page titled ‘Remove Ubuntu’.

And, voila, you get a pure LXDE desktop!lubuntu desktop

It may not look as pleasing as classic Gnome or Unity, but it’s quite usable and has a memory footprint as low as 100MB. PCManFM replaces Nautilus as the file manager. The window manager becomes Openbox.

The main problem I had to deal with was connecting to internet using my USB modem. The solution was to install the script they give in It automatically recognized my Dialog broadband connection. I

There is no Software Center in Lubuntu, only the Synaptic Package Manager. If you want you can search and install software-center from the Synaptic Manager.

 WARNING: When you install lubuntu-desktop with the above method, most of the apps that come bundled with Ubuntu are uninstalled. eg: LibreOffice is completely removed and AbiWord is installed instead.