{"id":18565080,"url":"https://github.com/jenly1314/libyuv","last_synced_at":"2026-05-02T10:01:34.174Z","repository":{"id":159249547,"uuid":"634520260","full_name":"jenly1314/libyuv","owner":"jenly1314","description":" :rainbow: 基于Google的libyuv编译封装的YUV转换工具库，主要用途是在各种YUV与RGB之间进行相互转换、裁减、旋转、缩放、镜像等。（用法超简单）","archived":false,"fork":false,"pushed_at":"2026-05-02T08:09:44.000Z","size":11474,"stargazers_count":42,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-05-02T09:34:51.795Z","etag":null,"topics":["android","convert","fourcc","fourcc-codes","i420","nv21","rgb-converter","rgb2yuv","yuv","yuv-conversion","yuv-tool","yuv2rgb","yuv420","yuv420p"],"latest_commit_sha":null,"homepage":"https://jenly1314.github.io/libyuv/","language":"C++","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/jenly1314.png","metadata":{"files":{"readme":"README.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-30T11:56:28.000Z","updated_at":"2026-05-02T08:09:11.000Z","dependencies_parsed_at":"2025-04-10T04:33:36.039Z","dependency_job_id":"222682e7-8c3a-4364-8b57-487fd236b295","html_url":"https://github.com/jenly1314/libyuv","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jenly1314/libyuv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2Flibyuv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2Flibyuv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2Flibyuv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2Flibyuv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenly1314","download_url":"https://codeload.github.com/jenly1314/libyuv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2Flibyuv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32530176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"online","status_checked_at":"2026-05-02T02:00:05.923Z","response_time":132,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","convert","fourcc","fourcc-codes","i420","nv21","rgb-converter","rgb2yuv","yuv","yuv-conversion","yuv-tool","yuv2rgb","yuv420","yuv420p"],"created_at":"2024-11-06T22:17:43.218Z","updated_at":"2026-05-02T10:01:34.167Z","avatar_url":"https://github.com/jenly1314.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LibYuv\n\n[![MavenCentral](https://img.shields.io/maven-central/v/com.github.jenly1314/libyuv?logo=sonatype)](https://repo1.maven.org/maven2/com/github/jenly1314/libyuv)\n[![JitPack](https://img.shields.io/jitpack/v/github/jenly1314/libyuv?logo=jitpack)](https://jitpack.io/#jenly1314/libyuv)\n[![CI](https://img.shields.io/github/actions/workflow/status/jenly1314/libyuv/build.yml?logo=github)](https://github.com/jenly1314/libyuv/actions/workflows/build.yml)\n[![Download](https://img.shields.io/badge/download-APK-brightgreen?logo=github)](https://raw.githubusercontent.com/jenly1314/libyuv/master/app/release/app-release.apk)\n[![API](https://img.shields.io/badge/API-21%2B-brightgreen?logo=android)](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)\n[![License](https://img.shields.io/github/license/jenly1314/libyuv?logo=open-source-initiative)](https://opensource.org/licenses/mit)\n\n\nLibYuv：基于Google的libyuv编译封装的YUV转换工具库，主要用途是在各种YUV与RGB之间进行相互转换、裁减、旋转、缩放、镜像等。\n\n## 效果展示\n![Image](GIF.gif)\n\n\u003e 你也可以直接下载 [演示App](https://raw.githubusercontent.com/jenly1314/libyuv/master/app/release/app-release.apk) 体验效果\n\n## 引入\n\n### Gradle:\n\n1. 在Project的 **build.gradle** 或 **setting.gradle** 中添加远程仓库\n\n    ```gradle\n    repositories {\n        //...\n        mavenCentral()\n    }\n    ```\n\n2. 在Module的 **build.gradle** 中添加依赖项\n    ```gradle\n    // AndroidX\n    implementation 'com.github.jenly1314:libyuv:1.1.0'\n    ```\n\n## 使用\n\n### 使用概要\n\nLibYuv中的功能方法主要包括：格式转换、裁减、旋转、缩放、镜像等；下面就以文档注释的形式对一些主要的方法做个简要说明。\n\n#### 格式转换\n```java\n/**\n * 将Image转换为I420\n *\n * @param image   图像；{@link Image}\n * @param degrees 需要旋转的角度\n * @return 返回I420数据\n */\nLibYuv.imageToI420(image, degrees)\n```\n\n```java\n/**\n * NV21转I420\n *\n * @param nv21Data 源NV21数据\n * @param width    图像宽度\n * @param height   图像高度\n * @return 返回I420数据\n */\nLibYuv.nv21ToI420(nv21Data, width, height)\n```\n\n```java\n/**\n * I420转NV21\n *\n * @param i420Data 源I420数据\n * @param width    图像宽度\n * @param height   图像高度\n * @return 返回NV21数据\n */\nLibYuv.i420ToNv21(i420Data, width, height)\n```\n\n##### 通用格式转换（各种YUV与RGB之间相互转换）\n\n```java\n/**\n * 将I420数据转换为指定格式的数据\n *\n * @param i420Data 源I420数据\n * @param width    图像宽度\n * @param height   图像高度\n * @param fourcc   指定数据格式；{@link FourCC}\n * @return 返回转换成指定格式后的数据\n */\nLibYuv.convertFromI420(i420Data, width, height, fourcc)\n```\n\n```java\n/**\n * 将指定格式的数据转换为I420数据\n *\n * @param srcData 源数据\n * @param width   图像宽度\n * @param height  图像高度\n * @param fourcc  指定数据格式；{@link FourCC}\n * @return 返回I420数据\n */\nLibYuv.convertToI420(srcData, width, height, fourcc)\n```\n\n#### 旋转\n```java\n/**\n * 将指定格式的数据进行旋转\n *\n * @param srcData 源数据\n * @param width   图像宽度\n * @param height  图像高度\n * @param degrees 需要旋转的角度；{@link  RotationMode}\n * @param fourcc  指定数据格式；{@link FourCC}\n * @return 返回旋转后的数据\n */\nLibYuv.rotate(srcData, width, height, degrees, fourcc)\n```\n\n#### 缩放\n```java\n/**\n * 将指定格式的数据进行缩放\n *\n * @param srcData    源数据\n * @param width      图像宽度\n * @param height     图像高度\n * @param dstWidth   目标宽\n * @param dstHeight  目标高\n * @param fourcc     指定数据格式；{@link FourCC}\n * @param filterMode 压缩过滤模式；{@link  FilterMode}\n * @return 返回缩放后的数据\n */\nLibYuv.scale(srcData, width, height, dstWidth, dstHeight, fourcc, filterMode)\n```\n\n#### 裁减\n```java\n/**\n * 将指定格式的数据进行裁减\n *\n * @param srcData  源数据\n * @param width    图像宽度\n * @param height   图像高度\n * @param cropRect 裁减的矩形区域\n * @param fourcc   指定数据格式；{@link FourCC}\n * @return 返回裁减后的数据\n */\nLibYuv.crop(srcData, width, height, cropRect, fourcc)\n```\n\n#### 镜像\n```java\n/**\n * 将指定格式的数据进行镜像翻转\n *\n * @param srcData 源数据\n * @param width   图像宽度\n * @param height  图像高度\n * @param fourcc  指定数据格式；{@link FourCC}\n * @return 返回镜像翻转后的数据\n */\nLibYuv.mirror(srcData, width, height, fourcc)\n```\n\n更多使用详情，请查看[app](app)中的源码使用示例或直接查看 [API帮助文档](https://jenly1314.github.io/libyuv/api/)\n\n**温馨提示**\n\n* 关于 **FourCC** 说明；在 **[FourCC](libyuv/src/main/java/com/king/libyuv/FourCC.java)** 中定义了很多数据格式类型（各种YUV与RGB格式；例如：I420、I422、NV21、NV12、ARGB、BGRA等）；\n\u003e 在使用各转换方法时，明确转换前和转换后的数据格式类型，这一点很重要。\n\n* 还有个小细节需要注意，如果在转换过程中出现转换结果图像的颜色与源图像颜色不一致时，很大可能是数据格式的问题；也就是数据的排列顺序不对，这时只需修改下入参的数据格式就行。\n\u003e 比如：当使用 **RGBA** 数据进行转换操作时，在使用LibYuv时数据的排列顺序是反的，这时需使用 **ABGR** 来表示这个排列（即：指定数据格式为：`FourCC.FOURCC_ABGR`）\n\n## 相关推荐\n\n- [CameraScan](https://github.com/jenly1314/CameraScan) 一个简化扫描识别流程的通用基础库。\n- [MLKit](https://github.com/jenly1314/MLKit) 一个强大易用的工具包。通过ML Kit您可以很轻松的实现文字识别、条码识别、图像标记、人脸检测、对象检测等功能。\n- [WeChatQRCode](https://github.com/jenly1314/WeChatQRCode) 基于OpenCV开源的微信二维码引擎移植的扫码识别库。\n- [ZXingLite](https://github.com/jenly1314/ZXingLite) 基于zxing实现的扫码库，优化扫码和生成二维码/条形码功能。\n- [ViewfinderView](https://github.com/jenly1314/ViewfinderView) ViewfinderView一个取景视图：主要用于渲染扫描相关的动画效果。\n\n\u003c!-- end --\u003e\n\n## 版本日志\n\n#### v1.1.0：2026-5-2\n- 适配Android 15+，支持 16KB 页面大小\n- 更新compileSdk版本至34\n- 更新gradle至v8.6\n- 对外提供可复用外部目标数据的各种转换方法\n- 优化细节\n\n#### [查看更多版本日志](CHANGELOG.md)\n\n---\n\n![footer](https://jenly1314.github.io/page/footer.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenly1314%2Flibyuv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenly1314%2Flibyuv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenly1314%2Flibyuv/lists"}