{"id":1458,"url":"https://github.com/ibireme/YYWebImage","last_synced_at":"2025-08-02T04:31:24.871Z","repository":{"id":49746485,"uuid":"45199481","full_name":"ibireme/YYWebImage","owner":"ibireme","description":"Asynchronous image loading framework.","archived":false,"fork":false,"pushed_at":"2020-11-05T01:54:44.000Z","size":28173,"stargazers_count":3550,"open_issues_count":118,"forks_count":613,"subscribers_count":95,"default_branch":"master","last_synced_at":"2025-07-04T05:53:53.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ibireme.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-10-29T17:29:09.000Z","updated_at":"2025-06-30T20:30:09.000Z","dependencies_parsed_at":"2022-09-22T14:41:16.033Z","dependency_job_id":null,"html_url":"https://github.com/ibireme/YYWebImage","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/ibireme/YYWebImage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYWebImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYWebImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYWebImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYWebImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibireme","download_url":"https://codeload.github.com/ibireme/YYWebImage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYWebImage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334611,"owners_count":24233793,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2024-01-05T20:15:46.919Z","updated_at":"2025-08-02T04:31:23.689Z","avatar_url":"https://github.com/ibireme.png","language":"Objective-C","funding_links":[],"categories":["Media","Objective-C","UI","HarmonyOS","iOS"],"sub_categories":["Image","Other free courses","Windows Manager","YYKit"],"readme":"YYWebImage\n==============\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/ibireme/YYWebImage/master/LICENSE)\u0026nbsp;\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/YYWebImage.svg?style=flat)](http://cocoapods.org/pods/YYWebImage)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/p/YYWebImage.svg?style=flat)](http://cocoadocs.org/docsets/YYWebImage)\u0026nbsp;\n[![Support](https://img.shields.io/badge/support-iOS%206%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)\u0026nbsp;\n[![Build Status](https://travis-ci.org/ibireme/YYWebImage.svg?branch=master)](https://travis-ci.org/ibireme/YYWebImage)\n\n![ProgressiveBlur~](https://raw.github.com/ibireme/YYWebImage/master/Demo/Demo.gif\n)\n\nYYWebImage is an asynchronous image loading framework (a component of [YYKit](https://github.com/ibireme/YYKit)).\n\nIt was created as an improved replacement for SDWebImage, PINRemoteImage and FLAnimatedImage.\n\nIt use [YYCache](https://github.com/ibireme/YYCache) to support memory and disk cache, and [YYImage](https://github.com/ibireme/YYImage) to support WebP/APNG/GIF image decode.\u003cbr/\u003e\nSee these project for more information.\n\n\nFeatures\n==============\n- Asynchronous image load from remote or local URL.\n- Animated WebP, APNG, GIF support (dynamic buffer, lower memory usage).\n- Baseline/progressive/interlaced image decode support.\n- Image loading category for UIImageView, UIButton, MKAnnotationView and CALayer.\n- Image effect: blur, round corner, resize, color tint, crop, rotate and more.\n- High performance memory and disk image cache.\n- High performance image loader to avoid main thread blocked.\n- Fully documented.\n\nUsage\n==============\n\n### Load image from URL\n```objc\n// load from remote url\nimageView.yy_imageURL = [NSURL URLWithString:@\"http://github.com/logo.png\"];\n\t\n// load from local url\nimageView.yy_imageURL = [NSURL fileURLWithPath:@\"/tmp/logo.png\"];\n```\t\n\n### Load animated image\n```objc\n// just replace `UIImageView` with `YYAnimatedImageView`\nUIImageView *imageView = [YYAnimatedImageView new];\nimageView.yy_imageURL = [NSURL URLWithString:@\"http://github.com/ani.webp\"];\n```\n\n### Load image progressively\n```objc\n// progressive\n[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressive];\n\t\n// progressive with blur and fade animation (see the demo at the top of this page)\n[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressiveBlur ｜ YYWebImageOptionSetImageWithFadeAnimation];\n```\n\n### Load and process image\n```objc\n// 1. download image from remote\n// 2. get download progress\n// 3. resize image and add round corner\n// 4. set image with a fade animation\n\t\n[imageView yy_setImageWithURL:url\n   placeholder:nil\n   options:YYWebImageOptionSetImageWithFadeAnimation\n   progress:^(NSInteger receivedSize, NSInteger expectedSize) {\n       progress = (float)receivedSize / expectedSize;\n   }\n   transform:^UIImage *(UIImage *image, NSURL *url) {\n       image = [image yy_imageByResizeToSize:CGSizeMake(100, 100) contentMode:UIViewContentModeCenter];\n       return [image yy_imageByRoundCornerRadius:10];\n   }\n   completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) {\n       if (from == YYWebImageFromDiskCache) {\n           NSLog(@\"load from disk cache\");\n       }\n   }];\n```\n \n### Image Cache\n```objc\nYYImageCache *cache = [YYWebImageManager sharedManager].cache;\n    \n// get cache capacity\ncache.memoryCache.totalCost;\ncache.memoryCache.totalCount;\ncache.diskCache.totalCost;\ncache.diskCache.totalCount;\n    \n// clear cache\n[cache.memoryCache removeAllObjects];\n[cache.diskCache removeAllObjects];\n    \n// clear disk cache with progress\n[cache.diskCache removeAllObjectsWithProgressBlock:^(int removedCount, int totalCount) {\n   // progress\n} endBlock:^(BOOL error) {\n   // end\n}];\n```\n\nInstallation\n==============\n\n### CocoaPods\n\n1. Update cocoapods to the latest version.\n2. Add `pod 'YYWebImage'` to your Podfile.\n3. Run `pod install` or `pod update`.\n4. Import \\\u003cYYWebImage/YYWebImage.h\\\u003e.\n5. Notice: it doesn't include WebP subspec by default, if you want to support WebP format, you may add `pod 'YYImage/WebP'` to your Podfile. You may call `YYImageWebPAvailable()` to check whether the WebP subspec is installed correctly.\n\n### Carthage\n\n1. Add `github \"ibireme/YYWebImage\"` to your Cartfile.\n2. Run `carthage update --platform ios` and add the framework to your project.\n3. Import \\\u003cYYWebImage/YYWebImage.h\\\u003e.\n4. Notice: carthage framework doesn't include webp component, if you want to support WebP format, use CocoaPods or install manually. You may call `YYImageWebPAvailable()` to check whether the WebP library is installed correctly.\n\n### Manually\n\n1. Download all the files in the YYWebImage subdirectory.\n2. Add the source files to your Xcode project.\n3. Link with required frameworks:\n\t* UIKit\n\t* CoreFoundation\n\t* QuartzCore\n\t* AssetsLibrary\n\t* ImageIO\n\t* Accelerate\n\t* MobileCoreServices\n\t* sqlite3\n\t* libz\n4. Import `YYWebImage.h`.\n5. Notice: if you want to support WebP format, you may add `Vendor/WebP.framework`(static library) to your Xcode project.\n\n\nDocumentation\n==============\nFull API documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/YYWebImage/).\u003cbr/\u003e\nYou can also install documentation locally using [appledoc](https://github.com/tomaz/appledoc).\n\n\nRequirements\n==============\nThis library requires `iOS 6.0+` and `Xcode 8.0+`.\n\n\nLicense\n==============\nYYWebImage is provided under the MIT license. See LICENSE file for details.\n\n\n\u003cbr/\u003e\u003cbr/\u003e\n---\n中文介绍\n==============\n![ProgressiveBlur~](https://raw.github.com/ibireme/YYWebImage/master/Demo/Demo.gif\n)\n\nYYWebImage 是一个异步图片加载框架 ([YYKit](https://github.com/ibireme/YYKit) 组件之一).\n\n其设计目的是试图替代 SDWebImage、PINRemoteImage、FLAnimatedImage 等开源框架，它支持这些开源框架的大部分功能，同时增加了大量新特性、并且有不小的性能提升。\n\n它底层用 [YYCache](https://github.com/ibireme/YYCache) 实现了内存和磁盘缓存, 用 [YYImage](https://github.com/ibireme/YYImage) 实现了 WebP/APNG/GIF 动图的解码和播放。\u003cbr/\u003e\n你可以查看这些项目以获得更多信息。\n\n\n特性\n==============\n- 异步的图片加载，支持 HTTP 和本地文件。\n- 支持 GIF、APNG、WebP 动画（动态缓存，低内存占用）。\n- 支持逐行扫描、隔行扫描、渐进式图像加载。\n- UIImageView、UIButton、MKAnnotationView、CALayer 的 Category 方法支持。\n- 常见图片处理：模糊、圆角、大小调整、裁切、旋转、色调等。\n- 高性能的内存和磁盘缓存。\n- 高性能的图片设置方式，以避免主线程阻塞。\n- 每个类和方法都有完善的文档注释。\n\n用法\n==============\n\n### 从 URL 加载图片\n```objc\n// 加载网络图片\nimageView.yy_imageURL = [NSURL URLWithString:@\"http://github.com/logo.png\"];\n\t\n// 加载本地图片\nimageView.yy_imageURL = [NSURL fileURLWithPath:@\"/tmp/logo.png\"];\n```\t\n\n### 加载动图\n```objc\n// 只需要把 `UIImageView` 替换为 `YYAnimatedImageView` 即可。\nUIImageView *imageView = [YYAnimatedImageView new];\nimageView.yy_imageURL = [NSURL URLWithString:@\"http://github.com/ani.webp\"];\n```\n\n### 渐进式图片加载\n```objc\n// 渐进式：边下载边显示\n[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressive];\n\t\n// 渐进式加载，增加模糊效果和渐变动画 （见本页最上方的GIF演示）\n[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressiveBlur ｜ YYWebImageOptionSetImageWithFadeAnimation];\n```\n\n### 加载、处理图片\n```objc\n// 1. 下载图片\n// 2. 获得图片下载进度\n// 3. 调整图片大小、加圆角\n// 4. 显示图片时增加一个淡入动画，以获得更好的用户体验\n\t\n[imageView yy_setImageWithURL:url\n   placeholder:nil\n   options:YYWebImageOptionSetImageWithFadeAnimation\n   progress:^(NSInteger receivedSize, NSInteger expectedSize) {\n       progress = (float)receivedSize / expectedSize;\n   }\n   transform:^UIImage *(UIImage *image, NSURL *url) {\n       image = [image yy_imageByResizeToSize:CGSizeMake(100, 100) contentMode:UIViewContentModeCenter];\n       return [image yy_imageByRoundCornerRadius:10];\n   }\n   completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) {\n       if (from == YYWebImageFromDiskCache) {\n           NSLog(@\"load from disk cache\");\n       }\n   }];\n```\n\n### 图片缓存\n```objc\nYYImageCache *cache = [YYWebImageManager sharedManager].cache;\n    \n// 获取缓存大小\ncache.memoryCache.totalCost;\ncache.memoryCache.totalCount;\ncache.diskCache.totalCost;\ncache.diskCache.totalCount;\n    \n// 清空缓存\n[cache.memoryCache removeAllObjects];\n[cache.diskCache removeAllObjects];\n    \n// 清空磁盘缓存，带进度回调\n[cache.diskCache removeAllObjectsWithProgressBlock:^(int removedCount, int totalCount) {\n   // progress\n} endBlock:^(BOOL error) {\n   // end\n}];\n```\n\n安装\n==============\n\n### CocoaPods\n\n1. 将 cocoapods 更新至最新版本.\n2. 在 Podfile 中添加 `pod 'YYWebImage'`。\n3. 执行 `pod install` 或 `pod update`。\n4. 导入 \\\u003cYYWebImage/YYWebImage.h\\\u003e。\n5. 注意：pod 配置并没有包含 WebP 组件, 如果你需要支持 WebP，可以在 Podfile 中添加 `pod 'YYImage/WebP'`。你可以调用 `YYImageWebPAvailable()` 来检查一下 WebP 组件是否被正确安装。\n\n### Carthage\n\n1. 在 Cartfile 中添加 `github \"ibireme/YYWebImage\"`。\n2. 执行 `carthage update --platform ios` 并将生成的 framework 添加到你的工程。\n3. 导入 \\\u003cYYWebImage/YYWebImage.h\\\u003e。\n4. 注意: carthage framework 并没有包含 webp 组件。如果你需要支持 WebP，可以用 CocoaPods 安装，或者手动安装。\n\n### 手动安装\n\n1. 下载 YYWebImage 文件夹内的所有内容。\n2. 将 YYWebImage 内的源文件添加(拖放)到你的工程。\n3. 链接以下 frameworks:\n\t* UIKit\n\t* CoreFoundation\n\t* QuartzCore\n\t* AssetsLibrary\n\t* ImageIO\n\t* Accelerate\n\t* MobileCoreServices\n\t* sqlite3\n\t* libz\n4. 导入 `YYWebImage.h`。\n5. 注意：如果你需要支持 WebP，可以将 `Vendor/WebP.framework`(静态库) 加入你的工程。你可以调用 `YYImageWebPAvailable()` 来检查一下 WebP 组件是否被正确安装。\n\n\n文档\n==============\n你可以在 [CocoaDocs](http://cocoadocs.org/docsets/YYWebImage/) 查看在线 API 文档，也可以用 [appledoc](https://github.com/tomaz/appledoc) 本地生成文档。\n\n\n系统要求\n==============\n该项目最低支持 `iOS 6.0` 和 `Xcode 8.0`。\n\n\n许可证\n==============\nYYWebImage 使用 MIT 许可证，详情见 LICENSE 文件。\n\n相关链接\n==============\n[移动端图片格式调研](https://blog.ibireme.com/2015/11/02/mobile_image_benchmark/)\u003cbr/\u003e\n\n[iOS 处理图片的一些小 Tip](https://blog.ibireme.com/2015/11/02/ios_image_tips/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibireme%2FYYWebImage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibireme%2FYYWebImage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibireme%2FYYWebImage/lists"}