Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

一款用于优化png图片的gradle插件,有效减少APK体积,支持极限压缩和无损压缩。

NotificationsYou must be signed in to change notification settings

chenenyu/img-optimizer-gradle-plugin

Repository files navigation

mavenLicenseAndroid ArsenalGitHub 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 onmacOSwindows10Ubuntu16.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 pictureorignal_opt.png fororiginal.png. Defaults to null.

Preview

Original pngExtreme compression(lossy)Loseless compression(lossless)
526K195K(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

About

一款用于优化png图片的gradle插件,有效减少APK体积,支持极限压缩和无损压缩。

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp