All posts for the month April, 2011

I’m pleased to announce the development of a new SpaceCraft Lantern Catalogue featuring all of the models available for purchase.  I was able to integrate a simple Paypal store gadget onto the Google Page where the catalogue now resides so you can buy them directly from the catalogue. 

If you’re a computer geek, you might appreciated that I did this with the help of some computer programming that will make it very easy to maintain a constantly updated list of models and their flavours (if not, enjoy the pretty stuff :-P ).

With the help of a GIMP python plugin script, now I can, with the click of a button, replace the white background of all rendered models in a folder with a starry background. This is the batch plugin:

#!/usr/bin/env python

import math
from gimpfu import *
import glob

def batch_spacecraft_backing( file_pattern):
for file_name in file_list:
image = pdb.gimp_file_load(file_name, file_name)
craftLayer = pdb.gimp_image_get_active_layer(image)
pdb.gimp_fuzzy_select(craftLayer, 1, 1, 0, 2, True, True, 5, False)
starsLayer = pdb.gimp_file_load_layer(image, “/home/cosmo/Pictures/Flames/Renders/stars01-01.png”)
image.add_layer(starsLayer, 1)
if starsLayer.width != image.width or starsLayer.height != image.height:
pdb.gimp_layer_scale(starsLayer, image.width, image.height, False)
mergedLayer = pdb.gimp_image_merge_visible_layers( image, 0)
pdb.file_png_save_defaults(image, image.active_layer , file_name, file_name)

“batch_spacecraft_backing”, “”, “”, “”, “”, “”,
/Xtns/Languages/Python-Fu/SpaceCrafting/_Batch Spacecraft Backing”, “”,
[(PF_STRING, "file_pattern", "file_pattern", "*.png"), ],


As a user of Ubuntu Linux, I added a simple shell script file to the ~/.gnome2/nautilus-scripts folder containing

gimp -d -f –no-interface –batch ‘(python-fu-batch-spacecraft-backing RUN-NONINTERACTIVE “*.png”)’

Now all I have to do is right-click inside the folder with the models, and go scripts->spacecraft-backing and it converts all images in that folder for me (I could just run the second line in the terminal inside the proper folder though).

I then run a python script which scans my hard drive for any new models and/or their associated flavours and uploads them to Picassa using the Google Data API.  In the spirit of Open Source, it goes:

import os

def convertFilenameToTitle(afilename):
    return afilename.replace(“.png”,  “”).replace(“_”, ” “).title()
username = ‘’
gd_client = = username
gd_client.password = ‘****’
gd_client.source = ‘exampleCo-exampleApp-1′

albumIDs = {}
albums = gd_client.GetUserFeed(user=username)
for album in albums.entry:
    if album.rights.text != ‘private’:
        print ‘title: %s, number of photos: %s, id: %s’ % (album.title.text,
        album.numphotos.text, album.gphoto_id.text)
        albumIDs[album.title.text] = album.gphoto_id.text
spacecraftModelsDir = “/home/cosmo/Pictures/0~Spacecrafts~0/0~SpaceCraftEngine~0/CGImodels/”

folderList = os.listdir(spacecraftModelsDir)
folderList = [i for i in folderList if os.path.isdir(spacecraftModelsDir+ i)  ]

#access each model folder
for folder in folderList:
    targetFolder = spacecraftModelsDir + folder + “/BackedRender/”
    fileList = os.listdir(targetFolder)
    folderList = [i for i in folderList if not os.path.isdir(targetFolder+i)  ]
    albumTitle = folder + ” Models”
    #add album for folder if it doesn’t exist
    if not albumTitle in albumIDs :
            thisAlbum = gd_client.InsertAlbum(title=albumTitle,  summary=’3D renderings of the ‘ + folder +” and its associated flavours available for purchase from The Playful Geometer’s Cosmic SpaceCraft Lantern Collection, see for more info on SpaceCraft Engineering.”)
    #generate a list of image filenames already in album
    photos = gd_client.GetFeed(‘/data/feed/api/user/%s/albumid/%s?kind=photo’ % ( username, albumIDs[albumTitle]) )
    photoFilelist = []
    for photo in photos.entry:
    for file in fileList:
        #if photo in folder doesn’t exist in album, upload it
        fileTitle = convertFilenameToTitle(file)
        if not file in photoFilelist:
            album_url = ‘/data/feed/api/user/%s/albumid/%s’ % (username, albumIDs[albumTitle])
            gd_client.InsertPhotoSimple(album_url, file, fileTitle,    targetFolder+file, content_type=’image/png’)

I also wrote a script to take every fractal for a given model, add a border around it, and generate the ‘net’ for the shape (the flat image which folds into a component pyramid).  Lastly, I’ve figured out how to automatically generate the CGI polyhedral models given a folder full of bordered tiles using Blender’s python scripting.  Intense geekery !  Programming has never been more useful !

Currently in the processing of automating the development and upload of SpaceCraft CGI models to the Picassa web album. Due to this, the catalogue will be missing for a time. The conversion of transparent areas of the images to a checker pattern proved to be unattractive so I wrote a batch script for The GIMP that enables me to replace a white background with an image of my choice for all of my models. Right now I am also working on a python script that will upload all models to Picassa and give captions reflecting the model names based on the file name. Soon my rapid prototyping automation system will enable me to very efficiently display and produce new SpaceCraft models so I can take more time to develop the graphic design aspects of this craft.