Image creation

Odalrick odalrick at hotmail.com
Thu Nov 2 07:11:36 EST 2006


I need to generate wx.Bitmap with a hole in them, i.e. the whole bitmap
is one colour, greyish with alpha = 255*.6, except for one rectangle
that has alpha = 0 .

Currently I'm doing this with PIL, thus:

	def _init_mask( self ):
		mask = Image.new( 'RGBA', self.size, color=options['mask_colour'] )
		draw = ImageDraw.Draw( mask )
		draw.rectangle( self.clip_area.box, fill=( 255, 255, 255, 0) )
		self._mask = pilToBitmap( mask, alpha=True )

Obviously this is inefficient, but I couldn't find any way to give
alpha values with wxPython's image objects and premature optimization
etcetera... Well, now the program works, but is a bit sluggish so I'm
asking if anyone can give me some pointers to speeding this up.

/Odalrick




More information about the Python-list mailing list