コード例 #1
0
ファイル: image.py プロジェクト: CadeLaRen/psychedelizer
 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)
コード例 #2
0
ファイル: tests.py プロジェクト: CadeLaRen/psychedelizer
 def testPatternList(self):
     print 'Patterns: {0}'.format(' '.join(pynbome.list_patterns()))