python - Loading greyscale images in wxPython -
i'm writing little desktop app using wxpython bit of image manipulation, i'm finding it's running rather slowly.
one of biggest problems @ moment using 3 channels of data (rgb) need 1 - greyscale images fine purposes.
at moment i'm manipulating images loading them numpy array. once processing done, they're converted wx image object (via imagefrombuffer()
function, loaded staticbitmap
user interface. seems lot of steps...
so have 2 questions - first how load numpy array directly greyscale wx image? possible?
the second more general - fastest way of dealing images in wxpython? don't have choice loop on numpy arrays (i need mathematical functionality), way of speeding things before , after process welcome!
you pingpong pil :)
def converttograyscale(img): import image, imageops orig = image.new("rgb", img.getsize()) orig.fromstring(img.getdata()) pil = imageops.grayscale(pil) ret = wx.emptyimage(pil.size[0], pil.size[1]) ret.setdata(pil.convert('rgb').tostring()) return ret
refer link link
Comments
Post a Comment