'''MakePhotomosaicDBImage.py This is a program to create a big tiled image of macropixels for use in creating Photomosaics. ''' def makeInitialDBImage(): # The prefix specifies the folder of tile images. prefix = 'Flower-tiles-128/' image_list_file = open(prefix + 'image-list.txt', 'r') all_image_filenames = image_list_file.read() filenames = all_image_filenames.split('\n') storageWindow = pmNewImage(0, 'Macro-pixel Storage Image',\ 2048, 1024, 0,0,0) miniImageWindow = pmNewImage(0, 'Tile Image', 128, 128, 0,0,0) pmSetSource1(storageWindow) pmSetSource2(miniImageWindow) pmSetDestination(storageWindow) row = 0; col = 0 for fn in filenames: if fn=='': continue print 'This filename is ' + fn pmOpenImage(miniImageWindow, prefix + fn) formula = 'S1(x,y)+if {floor(x/128)='+str(col)+\ ' and floor(y/128)='+str(row)+\ '} then S2(x mod 128, y mod 128) else 0' print formula pmSetFormula(formula) pmCompute() row += 1 if row==8: row=0; col+=1 makeInitialDBImage()