PhotoImage.paste

rryan.asu at gmail.com rryan.asu at gmail.com
Tue Jan 24 02:09:09 EST 2017


I'm trying to build a tkinter GUI with python 3.5, and would like to interactively adjust the color palette for an image by moving the mouse in the canvas using PIL.  In pseudo-code, I have something like

palette=color_map(x,y)   # x,y are scalars indicating the position of the mouse in the Canvas
image.putpalette(palette)
photo.paste(image)

This works just fine, but is very slow.  The photo.paste(image) step takes about 0.15 s (using an image that is 4k x 4k).  I read the manual on effbot, and they caution that the paste method would be slow if the image is display --- and I'm guessing that's what I'm doing.  So my question is, what alternatives do I have to speed that step up.  

Thank you for any thoughts you might have...
-Russell



More information about the Python-list mailing list