|
1 | 1 | # SDWebImageAVIFCoder
|
2 | 2 |
|
3 |
| -[](https://travis-ci.org/[email protected]/SDWebImageAVIFCoder) |
| 3 | +[](https://travis-ci.org/SDWebImage/SDWebImageAVIFCoder) |
4 | 4 | [](https://cocoapods.org/pods/SDWebImageAVIFCoder)
|
5 | 5 | [](https://cocoapods.org/pods/SDWebImageAVIFCoder)
|
6 | 6 | [](https://cocoapods.org/pods/SDWebImageAVIFCoder)
|
| 7 | +[](https://github.com/SDWebImage/SDWebImageAVIFCoder) |
7 | 8 |
|
8 |
| -## Example |
| 9 | +## What's for |
9 | 10 |
|
10 |
| -To run the example project, clone the repo, and run `pod install` from the Example directory first. |
| 11 | +This is a [SDWebImage](https://github.com/rs/SDWebImage) coder plugin to add [AV1 Image File Format (AVIF)](https://aomediacodec.github.io/av1-avif/) support. Which is built based on the open-sourced [libavif](https://github.com/joedrago/avif) codec. |
| 12 | + |
| 13 | +This AVIF coder plugin currently support AVIF still image **decoding**. Including alpha channel, as well as 10bit/12bit HDR images. |
| 14 | + |
| 15 | +The AVIF encoding is not currently support, because the software-based encoding speed is really slow. Need to wait for better enc implementation. |
| 16 | + |
| 17 | +Note: AVIF image spec is still in evolve. And the current AVIF codec is a simple implementation. |
| 18 | + |
| 19 | +Since AVIF is AV1-based inside HEIF image container. In the future, this repo may moved to existing HEIF coder plugin [SDWebImageHEIFCoder](https://github.com/SDWebImage/SDWebImageHEIFCoder) instead. |
11 | 20 |
|
12 | 21 | ## Requirements
|
13 | 22 |
|
| 23 | ++ iOS 8 |
| 24 | ++ tvOS 9.0 |
| 25 | ++ macOS 10.10 |
| 26 | ++ watchOS 2.0 |
| 27 | + |
14 | 28 | ## Installation
|
15 | 29 |
|
| 30 | +#### CocoaPods |
16 | 31 | SDWebImageAVIFCoder is available through [CocoaPods](https://cocoapods.org). To install
|
17 | 32 | it, simply add the following line to your Podfile:
|
18 | 33 |
|
19 | 34 | ```ruby
|
20 | 35 | pod 'SDWebImageAVIFCoder'
|
21 | 36 | ```
|
22 | 37 |
|
| 38 | +#### Carthage |
| 39 | + |
| 40 | +SDWebImageAVIFCoder is available through [Carthage](https://github.com/Carthage/Carthage). |
| 41 | + |
| 42 | +``` |
| 43 | +github "SDWebImage/SDWebImageAVIFCoder" |
| 44 | +``` |
| 45 | + |
| 46 | +## Usage |
| 47 | + |
| 48 | +To use AVIF coder, you should firstly add the `SDImageAVIFCoder.sharedCoder` to the coders manager. Then you can call the View Category method to start load AVIF images. |
| 49 | + |
| 50 | ++ Objective-C |
| 51 | + |
| 52 | +```objective-c |
| 53 | +SDImageAVIFCoder *AVIFCoder = SDImageAVIFCoder.sharedCoder; |
| 54 | +[[SDImageCodersManager sharedManager] addCoder:AVIFCoder]; |
| 55 | +UIImageView *imageView; |
| 56 | +[imageView sd_setImageWithURL:url]; |
| 57 | +``` |
| 58 | +
|
| 59 | ++ Swift |
| 60 | +
|
| 61 | +```swift |
| 62 | +let AVIFCoder = SDImageAVIFCoder.shared |
| 63 | +SDImageCodersManager.shared.addCoder(AVIFCoder) |
| 64 | +let imageView: UIImageView |
| 65 | +imageView.sd_setImage(with: url) |
| 66 | +``` |
| 67 | + |
| 68 | +## Screenshot |
| 69 | + |
| 70 | +<img src="https://raw.githubusercontent.com/SDWebImage/SDWebImageAVIFCoder/master/Example/Screenshot/AVIFDemo.png" width="300" /> |
| 71 | +<img src="https://raw.githubusercontent.com/SDWebImage/SDWebImageAVIFCoder/master/Example/Screenshot/AVIFDemo-macOS.png" width="600" /> |
| 72 | + |
| 73 | +The images are from [AV1 Still Image File Format Specification](https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles) |
| 74 | + |
23 | 75 | ## Author
|
24 | 76 |
|
25 |
| - |
| 77 | + |
26 | 78 |
|
27 | 79 | ## License
|
28 | 80 |
|
29 | 81 | SDWebImageAVIFCoder is available under the MIT license. See the LICENSE file for more info.
|
| 82 | + |
| 83 | +## Thanks |
| 84 | + |
| 85 | ++ [libavif](https://github.com/joedrago/avif) |
| 86 | ++ [aom](https://aomedia.googlesource.com/aom/) |
| 87 | + |
| 88 | + |
0 commit comments