Leanify

JayXonMIT更新放缓

轻量级无损文件压缩优化工具,能对 JPEG、PNG、ICO、EPUB、FB2 等格式做无损瘦身,适合打包发布前批量减小体积。

lightweight lossless file minifier/optimizer

v0.4.3发布于 2015-11-26 06:16 UTC851star79fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
make
硬件要求按 README 说明

README 未说明,仅提及支持 Windows、Linux、Mac 跨平台运行

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

轻量级无损文件压缩优化工具,去掉冗余数据并重新压缩,不损画质

轻量级无损文件压缩优化工具,能对 JPEG、PNG、ICO、EPUB、FB2 等格式做无损瘦身,适合打包发布前批量减小体积。

核心能力

  • 递归压缩嵌套容器内的文件,如 ZIP 里的 APK 里的 PNG
  • 支持 ZIP、PNG、JPEG、PE、XML、EPUB 等大量格式
  • 单文件不到 1MB,无外部依赖,全部在内存中处理
  • 按文件数据而非扩展名识别格式,可递归遍历目录
  • JPEG 用 mozjpeg、PNG 用 ZopfliPNG、ZIP 用 Zopfli 重压缩

容易踩的坑

会修改 APK、XPI 内文件从而破坏数字签名,需重新签名才能安装;默认迭代 15 次较慢,可用 -f 快速模式或 -i 调整;处理前务必备份文件,README 明确声明不对后果负责

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

4 个版本v0.4.3
  1. v0.4.3最新正式版2015-11-26 · 2015-11-26 06:16 UTC
    • Added support for Data URI #14.
    • Added support for DWF format.
    • Updated zopfli to 1.0.1.
    • Updated LZMA to 15.12.
    • Updated mozjpeg to 3.1.
    • Updated TinyXML2 to 3.0.0.
    • Improved PNG optimization for some cases.
    • Improved ZIP optimization for some cases.
    • Improved SVG minifying.
    • Added option --keep-exif.
    • Bug fixes and optimizations.
  2. v0.4.22014-11-07 · 2014-11-07 22:59 UTC
    查看更新说明
    • Added support for PE.
    • Added support for tar.
    • Added support for fb2.
    • Added support for removing SVG metadata.
    • New -d option to specify maximum recursive depth.
    • Updated TinyXML2 to 2.2.0
    • Enable SSE2 and Link Time Optimization.
    • Win: Added 64-bit build.
    • Win: More meaningful error message.
    • Linux, Mac: Fixed printing UTF16 string.
    • Other optimizations and bug fixes.
  3. v0.4.12014-08-10 · 2014-08-10 20:45 UTC
    查看更新说明
    • Add support for JPEG.
    • Add support for SWF.
    • Add support for XML with UTF8-BOM.
    • Improved command line arguments handling.
    • Fix gzip checksum.
  4. v0.4.02014-08-04 · 2014-08-04 23:42 UTC
    查看更新说明
    • First public release.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Leanify GitHub Actions CI Windows Build status Download Latest Release GitHub license

    Leanify is a lightweight lossless file minifier/optimizer. It removes unnecessary data (debug information, comments, metadata, etc.) and recompress the file to reduce file size. It will not reduce image quality at all.

    Features

    • Support recursive minifying. (e.g. a PNG inside an APK inside a ZIP)
    • Support a wide variety of file formats.
    • Lightweight, one file, under 1MB, no external dependency.
    • Everything is done in memory, no temporary files.
    • Cross-Platform, support Windows, Linux, Mac.
    • Support traverse directory recursively.
    • Ability to identify file format by its data instead of name.

    Disclaimer

    I'm not respossible for any consequence of using Leanify.

    PLEASE BACKUP THE FILE BEFORE USING LEANIFY!

    File Formats

    APK file (.apk)

    It is based on ZIP.

    Note that modifying files inside APK will break digital signature. To install it, you'll have to sign it again.

    If you don't want to modify any files inside APK, use -d 1 option.

    Comic book archive (.cbt, .cbz)

    cbt is based on tar. cbz is based on ZIP.

    Microsoft Office document 2007-2013 (.docx, .xlsx, .pptx)

    It is based on XML and ZIP.

    Office document 1997-2003 (.doc, .xls, .ppt) is not supported.

    Data URI (.html .htm .js .css)

    Looks for data:image/*;base64 and leanify base64 encoded embedded image.

    Design Web Format (.dwf, dwfx)

    It is based on ZIP.

    EPUB file (.epub)

    It is based on ZIP.

    FictionBook (.fb2, .fb2.zip)

    It is based on XML.

    Leanify embedded images.

    GFT file (.gft)

    It's an image container format found in Tencent QQ.

    Leanify the image inside.

    gzip file (.gz, .tgz)

    Leanify file inside and recompress deflate stream.

    Remove all optional section: FEXTRA, FNAME, FCOMMENT, FHCRC.

    Icon file (.ico)

    Convert 256x256 BMP to PNG.

    Leanify PNG inside, if any.

    Java archive (.jar)

    It is based on ZIP.

    JPEG image (.jpeg, .jpg, .jpe, .jif, .jfif, .jfi, .thm)

    Remove all application markers (e.g. Exif (use --keep-exif to keep it), ICC profile, XMP) and comments.

    Optimize with mozjpeg.

    Lua object file (.lua, .luac)

    Remove all debugging information:

    • Source name
    • Line defined and last line defined
    • Source line position list
    • Local list
    • Upvalue list
    OpenDocument (.odt, .ods, .odp, .odb, .odg, .odf)

    It is based on XML and ZIP.

    OpenRaster (.ora)

    It is based on OpenDocument and PNG.

    PE file (.exe, .dll, .ocx, .scr, .cpl)

    Leanify embedded resource.

    Remove Relocation Table in executable file.

    Remove undocumented Rich Header.

    Overlap PE Header and DOS Header.

    PNG image (.png, .apng)

    Remove all ancillary chunks except for:

    • tRNS: transparent information
    • fdAT, fcTL, acTL: These chunks are used by APNG
    • npTc: Android 9Patch images (*.9.png)

    Optimize with ZopfliPNG.

    RDB archive (.rdb)

    It is an archive format found in Tencent QQ.

    Leanify all files inside.

    Flash file (.swf)

    Leanify embedded images.

    Recompress it with LZMA.

    Remove Metadata Tag.

    SVG image (.svg, .svgz)

    It is based on XML.

    Remove metadata.

    Shrink spaces in attributes.

    Remove empty attributes.

    Remove empty text element and container element.

    tar archive (.tar)

    Leanify all files inside.

    XML document (.xml, .xsl, .xslt)

    Remove all comments, unnecessary spaces, tabs, line breaks.

    XPInstall (.xpi)

    It is based on ZIP.

    Note that modifying files inside xpi will break digital signature. To install it, you'll have to sign it again.

    XPS document (.xps, .oxps)

    It is based on XML and ZIP.

    ZIP archive (.zip)

    Leanify all files inside and recompress deflate stream using Zopfli.

    Use STORE method if DEFLATE makes file larger.

    Remove extra field in Local file header.

    Remove Data descriptor structure, write those information to Local file header.

    Remove extra field and file comment in Central directory file header.

    Remove comment in End of central directory record.

    Downloads

    Stable Releases

    Windows Nightly Build

    Usage

    Usage: leanify [options] paths
      -i, --iteration <iteration>   More iterations produce better result, but
                                      use more time, default is 15.
      -d, --max_depth <max depth>   Maximum recursive depth, unlimited by default.
                                      Set to 1 will disable recursive minifying.
      -f, --fastmode                Fast mode, no recompression.
      -q, --quiet                   No output to stdout.
      -v, --verbose                 Verbose output.
      -p, --parallel                Distribute all tasks to all CPUs.
      --keep-exif                   Do not remove Exif.
    

    Compiling

    Windows
    • Visual Studio 2015+

      Use Leanify.vcxproj

    • gcc 5+

      build_gcc.bat or mingw32-make

    Linux, Mac

    gcc 5+ or clang 3.6+

    make