python - Fast manner to change the color of a image using wx.Bitmap -


i have image in grayscale , want apply color. code working run slow. know if have other manner make it.

the code is:

img = wx.bitmap(path + file) self.applycolor(img, color)  def applycolor(self, img, color):     img = img.converttoimage()      rgb = wx.colour(color)     opacity = 0.7      x in range(0, img.width):         y in range(0, img.height):             r = img.getred(x, y)             g = img.getgreen(x, y)             b = img.getblue(x, y)             if (r > 0):                 img.setrgb(x, y, r * rgb[0], g * rgb[1], b * rgb[2])     img.adjustchannels(rgb[0], rgb[1], rgb[2], opacity)     return wx.bitmap(img) 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -