Ejemplo n.º 1
0
 def combine(self, pattern_name=None):
     """
     Apply pattern to the image. A random one
     chooses, if no pattern specified.
     
     @param pattern_name: name of pattern to apply
     @type pattern_name: string
     """
     
     if pattern_name is None:
         pattern_name = random.choice(pynbome.list_patterns())
     
     pattern_filename = os.path.join(os.path.dirname(__file__), pynbome.DATA_DIR, pattern_name)
         
     with Wand(filename=pattern_filename) as fg_img:
         #width, height = fg_img.size
         #self.img.crop(width=width, height=height)
         img_w, img_h = self.size()
         
         fg_img.resize(img_w, img_h)
 
         self.img.composite(fg_img, 0, 0)
         
         self.save_state(self.STATE_PATTERNS, pattern_name)
Ejemplo n.º 2
0
 def testPatternList(self):
     print 'Patterns: {0}'.format(' '.join(pynbome.list_patterns()))