def highQuality(self): global COUNTER #Search scraper Search.search() #Displaying a window massage, telling the user to select their background image displayBackgroundMessage() imagePath = getImagePath() tileFolder = "ImageTiles" image = Image.open(imagePath) width = image.size[0] size = getMuilt(width) build_mosaic( input_path = imagePath, output_path="mosaicImage"+str(COUNTER)+".png", collection_path= tileFolder, #Enlarge image zoom = size, #Tile size thumb_size = 20, fuzz=10, new_colormap=False ) COUNTER +=1 displayFinishMessage()
def process_upload(uploaded,filename,raw_data): #import pdb #pdb.set_trace() path=settings.MEDIA_ROOT+'/input/' input_pic=path+filename write_to_disk(uploaded, input_pic,raw_data) output_pic=path+'mosaic_'+filename build_mosaic(input_path=input_pic,output_path=output_pic,collection_path=path,zoom=10,fuzz=100,thumb_size=30,new_colormap=True) return True
def mediumQuality(self): global COUNTER Search.search() displayBackgroundMessage() imagePath = getImagePath() tileFolder = "ImageTiles" image = Image.open(imagePath) width = image.size[0] size = getMuilt(width) build_mosaic( input_path = imagePath, output_path="mosaicImage"+str(COUNTER)+".png", collection_path= tileFolder, #Enlarge image zoom = size, #Tile size thumb_size = 40, fuzz=10, new_colormap=False ) COUNTER +=1 displayFinishMessage()
for i in range(1, len(filelist)): try: # Attempt to open an image file filepath = filelist[i] image = Image.open(filepath) except IOError, e: # Report error, and then skip to the next argument print "Problem opening", filepath, ":", e continue # Resize the image image = image.resize(thumbnail_size, Image.ANTIALIAS) # Split our original filename into name and extension (file_path, extension) = os.path.splitext(filepath) file_path_split=file_path.split('/') print 'Converting '+thumbspicturefolder+file_path_split[len(file_path_split)-1]+'.jpg' # Save the thumbnail as "(original_name)_thumb.jpg" image.save(thumbspicturefolder+file_path_split[len(file_path_split)-1]+'.jpg') print "Building photo mosaic..." build_mosaic( input_path=inputpicture, output_path=outputmosaic, collection_path=thumbspicturefolder, zoom=4, thumb_size=thumbnail_size[0], fuzz=20, new_colormap=False )