def generate(self): width = self.parent_gui.width height = self.parent_gui.height self.analyze_image() self.current_image = Image.new("RGB", (width, height), self.base_color) draw = ImageDraw.Draw(self.current_image) #try: for each in self.colors: for x in range(0, 500): #distribution = [0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9] distribution = [0.5, 0.5, 0.9, 0.5, 0.5, 0.5, 0.9, 0.5] blob = DCS_utils.Cammo_blob(each, 0, draw, width, height, distribution, max_level=int( self.parent_gui.levels.get())) #except: # tkMessageBox.showerror(message="Input image file not specified") # return self.imagetk = ImageTk.PhotoImage(self.current_image) self.parent_gui.canvas.create_image(0, 0, image=self.imagetk) self.parent_gui.canvas.config( scrollregion=self.parent_gui.canvas.bbox(Tkinter.ALL))
def DCS_processor(source_image_path, num_colors, output_width, output_height): print source_image_path self.analyze_image() self.thumb = DCS_utils.source_image_thumbnail(self.source_image_path) self.parent_gui.canvas2.create_image(64,64,image=self.thumb) output_width = 600 output_height = 600 self.current_image = Image.new ( "RGB", (output_width,output_height), self.base_color ) draw = ImageDraw.Draw ( self.current_image ) for x in range(0, 500): blob = DCS_utils.Cammo_blob(self.colors[0],0,draw,width,height, max_level=2) blob = DCS_utils.Cammo_blob(self.colors[1],0,draw,width,height, max_level=2) blob = DCS_utils.Cammo_blob(self.colors[2],0,draw,width,height, max_level=2) self.imagetk = ImageTk.PhotoImage(self.current_image) self.parent_gui.canvas.create_image(0,0,image=self.imagetk) self.parent_gui.canvas.config(scrollregion=self.parent_gui.canvas.bbox(Tkinter.ALL))