Hi, I'm trying to use the function paste() to paste a image into another image but I can't get it work! Is it the right function to use or is there any other function that's better?
Here's my very simple code:
from PIL import Image
import ImageDraw
im = Image.new("RGB", (500,500), "white")
draw = ImageDraw.Draw(im)
icon = Image.open("icon1.jpg")
im.paste(icon, (0,0,86,62))
del draw
im.save("test.jpg", "JPEG")
and the message:
Traceback (most recent call last):
File "C:\Program Files\Eclipse 3.2.2\plugins\org.python.pydev.debug_1.3.4\pysrc\pydevd.py", line 754, in <module>
debugger.run(setup['file'], None, None)
File "C:\Program Files\Eclipse 3.2.2\plugins\org.python.pydev.debug_1.3.4\pysrc\pydevd.py", line 597, in run
execfile(file, globals, locals) #execute the script
File "C:\Documents and Settings\eviceng\My Documents\Python\cellTestare\src\paste.py", line 8, in <module>
im.paste(icon, (0,0,86,62))
File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1076, in paste
self.im.paste(im, box)
ValueError: images do not match