2 Replies Latest reply on Feb 8, 2008 1:48 PM by rinse

    NodeBox mashup with Kuler and Flickr

    rinse
      Hi all, I recently came across NodeBox, a generative art tool for Macs... They have a number of great functions already in the tool, and a very impressive set of 3rd party libraries, Kuler and Flickr included... so in a very lines of code I was able to create compositions like this one:

      http://www.flickr.com/photos/chadudell/2248119376/in/set-72157602761278378/

      Anyway, check out the rest of the set and then try out this code in NodeBox...

      size(500,500);
      web = ximport("web")

      # the search string, yo!
      q = "knife"

      images = web.flickr.search(q, start=1, count=100, cached=True)
      images.sort() # sort images according to times viewed

      for img in images:
      print img.name, img.views
      img = images[0]
      img.download(thumbnail=False)
      myImage = image(img.path, 0, 0, width=500, height=300)
      print img.author, img.path
      themes = web.kuler.search(q)
      for r, g, b in themes[0]:
      print r,g,b

      #create the text objects to dump out the author names, image names, theme names, etc.
      #depending on the image returned, I alter the "fill" colors to better suit the images or themes.
      fill(1,1,1)
      font("Helvetica", 20)
      text(img.name, 10, 275)
      text(img.author, 10, 295)
      fill(r,g,b)
      text(themes[0].author, 10, 420)
      text(themes[0].label, 10, 440)

      #i modify the width of the them rendered to match the photo, wasn't able to do something like image.width for some reason
      themes[0].draw(0, 300, w=90, h=100)