Make sure you give it the correct size of the icon ...
from PIL import Image
import ImageDraw
im = Image.new("RGB", (500,500), "white")
draw = ImageDraw.Draw(im)
icon = Image.open("icon1.jpg")
# get the correct size
x, y = icon.size
im.paste(icon, (0,0,x,y))
del draw
im.save("test.jpg", "JPEG")
# optional, show the saved image in the default viewer (works in Windows)
import webbrowser
webbrowser.open("test.jpg")
vegaseat
DaniWeb's Hypocrite
6,478 posts since Oct 2004
Reputation Points: 1,447
Solved Threads: 1,612
Skill Endorsements: 36
Strange, either method works fine for me!
I have Windows XP. What OS are you using? Shouldn't make a difference. Is your icon file a true JPEG?
Use ...
print icon.mode
this should show "RGB"
vegaseat
DaniWeb's Hypocrite
6,478 posts since Oct 2004
Reputation Points: 1,447
Solved Threads: 1,612
Skill Endorsements: 36
Question Answered as of 3 Years Ago by
vegaseat