Framing Leaders

Algorithmically generated framed pictures of heads of governments
, , ,

#!/usr/bin/python
#
import datetime
for row in cursor.fetchall():
  if row['country_code'] + ".png" in srcfiles:
    x = datetime.datetime.now().date() - row['h_gov_since']
    if x.days > 365*2:
      years = " ("+ str(math.floor(x.days/365))[:-2] + " years)"
    elif x.days < 365:
      years = " ("+ str(x.days) + " days)"
      
    else:
      years = " ("+ str(math.floor(x.days/365))[:-2] + " year)" 
    img = row['country_code'] + ".png"
    imgs.append(img)
    li[img] = row['country_name'].capitalize() + years
    height.append(Image.open(pathx + img).size[1]+35)
    width.append(Image.open(pathx + img).size[0]+20)
Flags By Colours

Data visualization experiment using flags of the world
, , , ,

#!/usr/bin/python
#
from sys import argv
import Image, ImageDraw 
im = Image.open(argv[1]) 
im = im.convert('RGB') 
colors = {}; total = 0
for y in range(im.size[1]):
  for x in range(im.size[0]):
    color = im.getpixel((x,y))
    if color in colors.keys():
      colors[color] += 1
    else:
      colors[color] = 1
    total += 1 
Generator

An evolving algorithm that generates music & visuals
, ,

#!/usr/bin/python
from common import *
import random


while 1:
  num = 000
  files = ls (images, 'jpg')
  last = len(files)
  half = str(round (last/2))
  half = int(half[:half.find('.')])-3
  using = files[last-10:last]
  using.sort()
  using.reverse()
  using += files[half:half+10]