• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

chenenyu/img-optimizer-gradle-plugin: 一款用于优化png图片的gradle插件,有效减少A ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

chenenyu/img-optimizer-gradle-plugin

开源软件地址(OpenSource Url):

https://github.com/chenenyu/img-optimizer-gradle-plugin

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

maven License Android Arsenal GitHub stars

中文版

img-optimizer-gradle-plugin

A gradle plugin for optimizing PNGs, effectively reducing APK size. Both extreme compression and lossless compression are available.

Available OS

Tested on macOSwindows10Ubuntu16.04LTS(amd64). If you have any questions, plz open issues.

How to use

Add the following Gradle configuration to your build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        ...
        classpath 'com.chenenyu:img-optimizer:latestVersion'
    }
}

Then in your moudle's build.gradle:

apply plugin: 'img-optimizer'

Now you can see the tasks in task tree:
Task
Double click to execute the task.

Configuration

You can add the following options to custom the task:

optimizerOptions {
    triggerSize 5
    type "lossy"
    suffix "_opt"
}
  1. triggerSize Used for filtering pictures. Picture whose size is less than this option will be ignored. Defaults to 0.
  2. type Now supports"lossy" and "lossless""lossy" means extreme compression(recommend, default, fast, effective),"lossless" means loseless compression(slow, inefficient)。
  3. suffix The suffix of the picture which has been optimized. If "_opt",the optimizer will generate a new picture orignal_opt.png for original.png. Defaults to null.

Preview

Original png Extreme compression(lossy) Loseless compression(lossless)
526K 195K(reduce 63%) 473K(reduce 10%)
原图 极限压缩 无损压缩

Note

If there are multiple modules in your project, please add the optimizer in where you want to execute optimization since each module is independent. The optimizer will generate log file in the root directory of current module.

License

Apache 2.0




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
FibreFoX/javafx-gradle-plugin: Gradle plugin for JavaFX发布时间:2022-06-11
下一篇:
Netflix/gradle-template发布时间:2022-06-11
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap