{"id":39306248,"url":"https://github.com/chenenyu/img-optimizer-gradle-plugin","last_synced_at":"2026-01-18T01:36:35.236Z","repository":{"id":50719580,"uuid":"62023235","full_name":"chenenyu/img-optimizer-gradle-plugin","owner":"chenenyu","description":"一款用于优化png图片的gradle插件，有效减少APK体积，支持极限压缩和无损压缩。","archived":false,"fork":false,"pushed_at":"2022-02-21T12:34:52.000Z","size":2096,"stargazers_count":788,"open_issues_count":0,"forks_count":104,"subscribers_count":21,"default_branch":"master","last_synced_at":"2023-10-20T18:47:41.245Z","etag":null,"topics":["android","apksize","gradle-plugin","optimize","png"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenenyu.png","metadata":{"files":{"readme":"README-zh-rCN.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-27T03:36:43.000Z","updated_at":"2023-09-15T09:22:46.000Z","dependencies_parsed_at":"2022-09-26T21:31:21.283Z","dependency_job_id":null,"html_url":"https://github.com/chenenyu/img-optimizer-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":5,"template":null,"template_full_name":null,"purl":"pkg:github/chenenyu/img-optimizer-gradle-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenenyu%2Fimg-optimizer-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenenyu%2Fimg-optimizer-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenenyu%2Fimg-optimizer-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenenyu%2Fimg-optimizer-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenenyu","download_url":"https://codeload.github.com/chenenyu/img-optimizer-gradle-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenenyu%2Fimg-optimizer-gradle-plugin/sbom","scorecard":{"id":276043,"data":{"date":"2025-08-11","repo":{"name":"github.com/chenenyu/img-optimizer-gradle-plugin","commit":"86771df4c70a0cf4d11da43fec3be1eda2463cd8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":3,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1","Warn: binary detected: img-optimizer/src/main/resources/pngquant/pngquant:1","Warn: binary detected: img-optimizer/src/main/resources/pngquant/pngquant-mac:1","Warn: binary detected: img-optimizer/src/main/resources/pngquant/pngquant.exe:1","Warn: binary detected: img-optimizer/src/main/resources/zopflipng/zopflipng:1","Warn: binary detected: img-optimizer/src/main/resources/zopflipng/zopflipng-mac:1","Warn: binary detected: img-optimizer/src/main/resources/zopflipng/zopflipng.exe:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T14:25:06.147Z","repository_id":50719580,"created_at":"2025-08-17T14:25:06.147Z","updated_at":"2025-08-17T14:25:06.147Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28526556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"ssl_error","status_checked_at":"2026-01-18T00:39:39.467Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","apksize","gradle-plugin","optimize","png"],"created_at":"2026-01-18T01:36:34.868Z","updated_at":"2026-01-18T01:36:35.227Z","avatar_url":"https://github.com/chenenyu.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"![maven](https://img.shields.io/maven-central/v/com.chenenyu/img-optimizer) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-img--optimizer--gradle--plugin-green.svg?style=true)](https://android-arsenal.com/details/1/3863) [![GitHub stars](https://img.shields.io/github/stars/chenenyu/img-optimizer-gradle-plugin.svg)](https://github.com/chenenyu/img-optimizer-gradle-plugin/stargazers)\n\n# img-optimizer-gradle-plugin\n\n\u003e一款用于优化png图片的gradle插件，有效减少APK体积，支持极限压缩和无损压缩。\n\n### 支持的OS\n\n在`macOS`、`windows10`、`Ubuntu16.04LTS(amd64)`上测试通过，如果有更多需求，请提issue。\n\n### 如何使用\n\n在Project的build.gradle文件中:  \n\n```\nbuildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        ...\n        classpath 'com.chenenyu:img-optimizer:版本号'\n    }\n}\n```  \n\n然后在你想要优化的module的build.gradle文件中:  \n\n`apply plugin: 'img-optimizer'`  \n\n然后在task tree里面就可以看到对应的task:  \n![Task](arts/task.png)  \n双击即可执行。task的名字受当前module的命名影响。\n\n### 支持的配置项\n可以在module的build.gradle文件中添加配置选项，来自定义任务:  \n\n```\noptimizerOptions {\n    triggerSize 5\n    type \"lossy\"\n    suffix \"_opt\"\n}\n```  \n\n1. `triggerSize` 用于过滤图片，小于该值的图片不会进行优化。默认为0，即每张图片都进行优化。\n2. `type` 优化类型，目前支持`\"lossy\"`和`\"lossless\"`。`\"lossy\"`为极限压缩(推荐，速度快，压缩率高)，`\"lossless\"`为无损压缩(速度慢，压缩率低，与原图无差别)。\n3. `suffix` 优化后的图片后缀。假如配置为`\"_opt\"`，`ic_launcher.png`经过优化后，将会生成`ic_launcher_opt.png`。默认为空，即覆盖原图。\n\n### 效果预览\n\n|原图|极限压缩(lossy)|无损压缩(lossless)|\n|:---:|:---:|:---:|\n|526K|195K(减少63%)|473K(减少10%)|\n|![原图](arts/lenna.png)|![极限压缩](arts/lenna_lossy.png)|![无损压缩](arts/lenna_lossless.png)|\n\n### 说明\n\n如果项目有多个module，请在相应的build.gradle中配置plugin，每个module相互独立。执行task后会在module根目录下生成log文件，详细记录了每张图片的优化情况，方便查看。\n\n### License\n\n[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenenyu%2Fimg-optimizer-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenenyu%2Fimg-optimizer-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenenyu%2Fimg-optimizer-gradle-plugin/lists"}