texturepacker使用python调用命令行对批量图片进行打包
2017-11-03 18:53
1481 查看
我的python版本是2.7,texturepacker版本是3.2.1,使用的操作系统是windows7。如果是在MAC或者Linux下方法也是一样的。texturepacker支持mac系统,但不知道是否支持linux。
啥也不说了,直接上python的脚本。 # -*- coding: cp936 -*-
import os,sys
imagedir = 'D:\\SVN\\前端\\公共\\武将图片\\hero1230'#图片所在文件夹
outplistdir = 'D:\\SVN\\前端\\公共\\武将图片\\AllHeroPlist'#打包后输出的文件夹
comend = 'texturepacker'#图片打包软件,这里要把这个软件加入到环境变量中,要不然就要写这个软件的完整路径
print "imagedir = %s \noutdir = "%imagedir,outplistdir
herolist = os.listdir(imagedir)
print "heave %d hero convert"%len(herolist)
for n in range(len(herolist)):
herodirtmp = imagedir + os.sep + herolist
herotmplist = os.listdir(herodirtmp)
cmdtmp = comend
print "hero %s heave image = %d"%(str(herolist
),len(herotmplist))
allImage = ""
for im in range(len(herotmplist)):
allImage = allImage + " " + herodirtmp + os.sep + herotmplist[im]
cmdtmp = cmdtmp + " " + allImage +\
" --data " + outplistdir + os.sep + herolist
+ ".plist"\
" --sheet " + outplistdir + os.sep + herolist
+ ".pvr.ccz"\
" --opt RGBA4444 --dither-fs-alpha --content-protection \
19e5c826f732e5325e58d0c52488c7ac"
os.system(cmdtmp)
我是把texturepacker所在位置加入到了环境变量中,如果你没有加你就要在运行命行的时候cd到这个目录,或者写上程序的全路径,要查看texturepacker的帮助,只要在命令提示行下输入texturepacker就可以看到了。
啥也不说了,直接上python的脚本。 # -*- coding: cp936 -*-
import os,sys
imagedir = 'D:\\SVN\\前端\\公共\\武将图片\\hero1230'#图片所在文件夹
outplistdir = 'D:\\SVN\\前端\\公共\\武将图片\\AllHeroPlist'#打包后输出的文件夹
comend = 'texturepacker'#图片打包软件,这里要把这个软件加入到环境变量中,要不然就要写这个软件的完整路径
print "imagedir = %s \noutdir = "%imagedir,outplistdir
herolist = os.listdir(imagedir)
print "heave %d hero convert"%len(herolist)
for n in range(len(herolist)):
herodirtmp = imagedir + os.sep + herolist
herotmplist = os.listdir(herodirtmp)
cmdtmp = comend
print "hero %s heave image = %d"%(str(herolist
),len(herotmplist))
allImage = ""
for im in range(len(herotmplist)):
allImage = allImage + " " + herodirtmp + os.sep + herotmplist[im]
cmdtmp = cmdtmp + " " + allImage +\
" --data " + outplistdir + os.sep + herolist
+ ".plist"\
" --sheet " + outplistdir + os.sep + herolist
+ ".pvr.ccz"\
" --opt RGBA4444 --dither-fs-alpha --content-protection \
19e5c826f732e5325e58d0c52488c7ac"
os.system(cmdtmp)
我是把texturepacker所在位置加入到了环境变量中,如果你没有加你就要在运行命行的时候cd到这个目录,或者写上程序的全路径,要查看texturepacker的帮助,只要在命令提示行下输入texturepacker就可以看到了。
相关文章推荐
- TexturePacker(图片打包工具)使用教程---初级篇
- TexturePacker 图片打包工具讲解与使用并且批处理打多包以及资源加密
- 利用python进行批量导出时态图片
- 使用python进行图像处理-调整图片大小
- 使用vs2010进行Qt和Python混合编程并打包
- 解决三星GT-s5831i 加载TexturePacker打包的图片文件会花屏的bug
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- 使用命令行调用Beyond Compare进行文件对比
- 【Python】Python的urllib、urllib2模块调用“百度翻译”API进行批量自动翻译
- [置顶] Android 使用Android Studio + Gradle 或 命令行 进行apk签名打包
- 使用python进行图像处理-调整图片大小
- 使用命令行调用Beyond Compare进行文件对比
- 使用python将豆瓣妹子的图片批量搬运到百度网盘
- python 使用ssh连接服务器进行远程命令行操作
- 使用python调用zxing库生成二维码图片
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x—使用TexturePacker对图片进行打包、加密
- Cocos2d-x笔记(六)—使用TexturePacker对图片进行打包、加密
- python,使用PIL库对图片进行操作