local plistFile = "" --你的plist路径
local pngFile = "" --你的大图路径
cc.SpriteFrameCache:getInstance():addSpriteFrames(plistFile) --加载图片进内存
local vectormap = cc.FileUtils:getInstance():getValueMapFromFile(plistFile) --读取plist
local frames = vectormap.frames
local writablePath = cc.FileUtils:getInstance():getWritablePath()
for key,value in pairs(frames) do
local str = key --获得plist内的图片名
local spr = cc.Sprite:createWithSpriteFrameName(str)
local size = spr:getContentSize()
local render = cc.RenderTexture:create(size.width, size.height)
spr:setPosition(cc.p(size.width / 2, size.height / 2))
render:begin()
spr:visit()
render:endToLua()
render:saveToFile(writablePath .. str, cc.IMAGE_FORMAT_PNG) --写到文件
print("save " .. str .. " to ".. writablePath .. str)
end