Python论坛  - 讨论区

标题:[python-chinese] Re: Re: \[python\-chinese\] python 下如何实现图片的叠加?

2006年08月07日 星期一 17:52

yeqiwei001 at gmail.com yeqiwei001 at gmail.com
Mon Aug 7 17:52:33 HKT 2006

找到了~
try this,

import Image

RED   = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE  = (0, 0, 255)
# create/read your images
bg  = Image.new('RGB', (800, 600), RED)
img = Image.new('RGB', (400, 400), GREEN)
## paste it
W, H = bg.size
w, h = img.size
xo, yo = (W-w)/2, (H-h)/2
bg.paste(img, (xo, yo, xo+w, yo+h))
## voila!
bg.show()

you may also consider using ImageMagick (www.imagemagick.org) for this special case.

hope this helps.


pil应该可以


On 8/7/06, ye qiwei <yeqiwei001 at gmail.com> wrote:
 将一个小图片叠加到一个大图片上,将大图片上作为背景,该怎么做?
google 没有找到

_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn 
Subscribe: send subscribe to python-chinese-request at lists.python.cn
Unsubscribe: send unsubscribe to   python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese





-- 
http://www.flyaflya.com powered by pygame+python 

= = = = = = = = = = = = = = = = = = = = = = 
        致
礼!

              
              
               
asdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060807/d8dd5cf8/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号