单张/整目录 PNG → DDS;
纯 Python 路径:写 RGBA8(未压缩) DDS(跨平台,无外部依赖);
如系统已装压缩工具,会优先用
DirectXTex texconv(BC1/BC3/BC7) 或 NVIDIA nvcompress 做压缩输出;
自动判断是否含透明通道(含透明默认选 BC3/DXT5,否则 BC1/DXT1),也可手动指定;
可选生成 mipmap。
没装 texconv/nvcompress 时,也会回退到纯 Python 生成 RGBA8 DDS(文件大,但最稳)。
依赖
pip install pillow
用法
基本:把 a.png 转成 a.dds(优先 BC 压缩,找不到工具就写 RGBA8)
python png2dds.py a.png
指定输出目录
python png2dds.py assets/ui icons_dds/
递归处理目录
python png2dds.py assets/ textures_out/ --recursive
强制格式:rgba8 / bc1 / bc3 / bc7
python png2dds.py a.png -f bc7
生成 mipmap(自动全链),或只 1 级(none=不生)
python png2dds.py a.png --mips auto
python png2dds.py a.png --mips 1
垂直翻转(某些引擎坐标系需要)
python png2dds.py a.png --flipv
脚本(保存为 png2dds.py)
***付费内容***
剩余 89% 内容需要支付 100.00
金币 后可完整阅读
支持付费阅读,激励作者创作更好的作品。
|