30 lines
760 B
Lua
30 lines
760 B
Lua
local path_src = File.GetAbsolute("./src/")
|
|
local path_out = File.GetAbsolute("./out/")
|
|
|
|
-- 创建输出目录
|
|
File.DeleteContent(path_out)
|
|
File.CreateFolder(path_out)
|
|
|
|
local ret_files = File.GetPathFileAll(path_src, Img.REGEX_FORMAT, false)
|
|
|
|
for key, value in pairs(ret_files) do
|
|
|
|
local path = File.GetFilePath(value)
|
|
local filename = File.GetFileName(value)
|
|
local out = path_out .. string.lower(filename)
|
|
|
|
|
|
local img = Img.Create(value)
|
|
if img then
|
|
-- 参数为 透明度阈值、替换后颜色argb
|
|
Img.CvtEffect2Normal(img)
|
|
Img.Save(img, out)
|
|
delete(img)
|
|
|
|
print(value.."->"..out)
|
|
end
|
|
end
|
|
|
|
print "此工具会将src文件夹的所有图片(特效)转换为带alpha的透明图片"
|
|
|
|
pause() |