zoukankan      html  css  js  c++  java
  • TexturePacker压缩png的命令

    压缩png效果最好的当然是TinyPNG这种神器了,不过一般情况下TexturePacker压缩出来的也基本上能达到效果。

    你需要先安装TP(TexturePacker的简称,以下TP无特殊说明均指TexturePacker)

    xx:CodeAndWebTexturePackerin

    GUI程序是可视化操作的,实际最终会调用TexturePacker.exe方法,在DOS下直接输入“TexturePacker.exe”会显示所有参数使用说明,DOS窗口如果显示内容过小可以使用下面的命令将输出导到文本中

    TexturePacker.exe –help >help.txt

     

    这样你打开txt就能看到命令行详细的参数说明了,常用的几个参数是:

    --data 生成的.plist文件名

    --format 数据格式类型,默认为cocos2d

    --texture-format  默认使用输出的文件后缀名

    --disable-rotation 禁止旋转

    --shape-padding

    --border-padding

    --opt RGBA4444

    --sheet 输出路径

    --algorithm 使用的算法,一般选MaxRects

    --dither-fs-alpha 使用抖动的抖动算法(Floyd-Steinberg +  alpha)

    老版本有一个参数叫 –allow-free-size,新版本中使用—trim-mode替代

    --trim-mode <value>         Remove transparent parts of a sprite to shrink atlas size and speed up rendering
                                                None - Keep transparent pixels
                                                Trim - Remove transparent pixels, use original size.
                                                Crop - Remove transparent pixels, use trimmed size, flush position.
                                         CropKeepPos - Remove transparent pixels, use trimmed size, keep position.

    --size-constraints <value>  Restrict sizes
                                                  POT - Power of 2 (2,4,8,16,32,...)
                                              AnySize - Minimum size
                                                 NPOT - Any size but power of 2

    其它诸如强制宽高一致(--force-squared 强制为正方形参数)用的不多

    示例:

    TexturePacker.exe  --opt RGBA4444 --dither-fs-alpha --size-constraints AnySize --padding 0 --trim-mode None  --disable-rotation  --format cocos2d --data tmp.plist --sheet "test.png"  "1002.png"

     

    如果你想写工具,可以查看我之前的一篇文章,通过注册表获取TP的安装目录:《bat调用TexturePacker更新SpriteSheet》

  • 相关阅读:
    <%%>与<scriptrunat=server>,<%=%>与<%#%>的区别
    UVA 11134
    Codeforces Round #219 (Div. 1)(完全)
    Delphi版浏览器(持续更新)
    Spring3.0 入门进阶(三):基于XML方式的AOP使用
    UVa 10801 Lift Hopping / floyd
    poj 3501 Escape from Enemy Territory 二分+bfs
    vim 编辑器
    RRT路径规划算法(matlab实现)
    A*寻路算法C++简单实现
  • 原文地址:https://www.cnblogs.com/meteoric_cry/p/4835681.html
Copyright © 2011-2022 走看看