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:
[CODE=python]
from PIL import Image
import ImageDraw
im = Image.new("RGB" , (500,500), "white")
draw = ImageDraw.Draw( im)
icon = Image.open("ico n1.jpg")
im.paste(icon, (0,0,86,62))
del draw
im.save("test.j pg", "JPEG")[/CODE]
and the message:
/flaerpen
Here's my very simple code:
[CODE=python]
from PIL import Image
import ImageDraw
im = Image.new("RGB" , (500,500), "white")
draw = ImageDraw.Draw( im)
icon = Image.open("ico n1.jpg")
im.paste(icon, (0,0,86,62))
del draw
im.save("test.j pg", "JPEG")[/CODE]
and the message:
Code:
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
Comment