{"id":18014437,"url":"https://github.com/shouheng88/compressor","last_synced_at":"2025-04-05T07:03:23.343Z","repository":{"id":45358435,"uuid":"175025191","full_name":"Shouheng88/Compressor","owner":"Shouheng88","description":"An easy to use image compress library for Android.","archived":false,"fork":false,"pushed_at":"2021-12-18T10:49:19.000Z","size":9344,"stargazers_count":605,"open_issues_count":0,"forks_count":54,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T06:03:02.569Z","etag":null,"topics":["android","compressor","image","image-processing","luban"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shouheng88.png","metadata":{"files":{"readme":"README-zh.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-11T15:06:53.000Z","updated_at":"2025-03-20T09:31:27.000Z","dependencies_parsed_at":"2022-08-12T11:51:44.114Z","dependency_job_id":null,"html_url":"https://github.com/Shouheng88/Compressor","commit_stats":null,"previous_names":["shouheng88/easycompressor"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shouheng88%2FCompressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shouheng88%2FCompressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shouheng88%2FCompressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shouheng88%2FCompressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shouheng88","download_url":"https://codeload.github.com/Shouheng88/Compressor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","compressor","image","image-processing","luban"],"created_at":"2024-10-30T04:09:31.617Z","updated_at":"2025-04-05T07:03:23.320Z","avatar_url":"https://github.com/Shouheng88.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    一款易用的 Android 图片压缩框架\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://www.apache.org/licenses/LICENSE-2.0\"\u003e\n    \u003cimg src=\"https://img.shields.io/hexpm/l/plug.svg\" alt=\"License\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bintray.com/beta/#/easymark/Android/compressor?tab=overview\"\u003e\n    \u003cimg src=\"https://img.shields.io/maven-metadata/v/https/s01.oss.sonatype.org/service/local/repo_groups/public/content/com/github/Shouheng88/compressor/maven-metadata.xml.svg\" alt=\"Version\" /\u003e\n  \u003ca href=\"https://www.codacy.com/manual/Shouheng88/Compressor?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=Shouheng88/Compressor\u0026amp;utm_campaign=Badge_Grade\"\u003e\n    \u003cimg src=\"https://api.codacy.com/project/badge/Grade/84a3602d08034493a4a62c73f7ad86f4\" alt=\"Code Grade\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.travis-ci.org/Shouheng88/Compressor\"\u003e\n    \u003cimg src=\"https://www.travis-ci.org/Shouheng88/Compressor.svg?branch=master\" alt=\"Build\"/\u003e\n  \u003c/a\u003e\n    \u003ca href=\"https://developer.android.com/about/versions/android-4.2.html\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/API-17%2B-blue.svg?style=flat-square\" alt=\"Min Sdk Version\" /\u003e\n  \u003c/a\u003e\n   \u003ca href=\"https://github.com/Shouheng88\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Author-CodeBrick-orange.svg?style=flat-square\" alt=\"Author\" /\u003e\n  \u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://shang.qq.com/wpa/qunwpa?idkey=2711a5fa2e3ecfbaae34bd2cf2c98a5b25dd7d5cc56a3928abee84ae7a984253\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/QQ%E7%BE%A4-1018235573-orange.svg?style=flat-square\" alt=\"QQ Group\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n更高级的 Android 图片压缩库，支持自定义：\n\n- 图片类型 (Uri/File/bitmap/Byte 数组/自定义)\n- 结果类型 (Bitmap/File)\n- 任务执行模式 (阻塞/RxJava/Kotlin 协程/AsyncTask)\n- 压缩算法\n\n要使用该库，首先添加 maven central 仓库，\n\n```gradle\nrepositories { mavenCentral() }\n```\n\n然后添加该项目的依赖，\n\n```gradle\nimplementation 'com.github.Shouheng88:compressor:latest-version'\n```\n\n示例：以压缩 Uri 图片、获取 File 类型的结果、在 Kotlin 协程中启动为例。整个代码是，\n\n```kotlin\nGlobalScope.launch {\n    val result = Compress.with(context, file.uri(context))\n        .setQuality(80)\n        .concrete {\n            withMaxWidth(100f)\n            withMaxHeight(100f)\n            withScaleMode(ScaleMode.SCALE_HEIGHT)\n            withIgnoreIfSmaller(true)\n        }\n        .get(Dispatchers.IO)\n    withContext(Dispatchers.Main) {\n        Glide.with(context).load(result).into(binding.iv6)\n    }\n}\n```\n\n该库允许你对多个地方进行自定义，\n\n- 了解更多使用方式，请阅读 [示例工程](sample/app/src/main/java/me/shouheng/sample/view/SampleActivity.kt).\n- 了解如何自定义图片压缩算法，请阅读 [自定义算法示例](sample/app/src/main/java/me/shouheng/sample/custom/AlwaysHalfAlgorithm.kt).\n- 了解如何自定义图片类型，请阅读 [自定义图片类型示例](sample/app/src/main/java/me/shouheng/sample/custom/AssetsResourceSource.kt).\n\n## License\n\n```\nCopyright (c) 2019-2021 Shouheng Wang.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshouheng88%2Fcompressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshouheng88%2Fcompressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshouheng88%2Fcompressor/lists"}