Created
March 19, 2015 01:53
-
-
Save liyonghelpme/29b974569b82a145aeef to your computer and use it in GitHub Desktop.
将 ogre 火炬之光 cegui的 九宫格 图片 拼接为一个 大图 给 ngui使用
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL | |
from PIL import Image | |
import xml | |
import xml.sax | |
import xml.sax.handler | |
import os | |
imname = ["TopLeft", "TopEdge", "TopRight", | |
"LeftEdge", "Middle", "RightEdge", | |
"BottomLeft", "BottomEdge", "BottomRight", | |
] | |
ims = [] | |
size = None | |
for i in xrange(0, 9): | |
im = Image.open("ItemTooltip"+imname[i]+".png") | |
ims.append(im) | |
size = im.size | |
totalSize = [size[0]*3, size[1]*3] | |
c = 0 | |
im = Image.new("RGBA", totalSize) | |
for i in ims: | |
im.paste(i, ((c%3)*size[0], (c/3)*size[1])) | |
c = c+1 | |
im.save("ItemTooltip.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment