Skip to content

Commit d66afa7

Browse files
committed
Update the demo code and screenshot
1 parent df89239 commit d66afa7

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

Example/SDWebImageAVIFCoder/SDViewController.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ - (void)viewDidLoad
2323
SDImageAVIFCoder *AVIFCoder = [SDImageAVIFCoder sharedCoder];
2424
[[SDImageCodersManager sharedManager] addCoder:AVIFCoder];
2525
NSURL *AVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/fox.profile0.8bpc.yuv420.avif"];
26-
NSURL *HDRAVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/hato.profile2.12bpc.yuv422.avif"];
26+
// NSURL *HDRAVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/hato.profile2.12bpc.yuv422.avif"];
27+
NSURL *animatedAVIFSURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/star-12bpc-with-alpha.avifs"];
2728
CGSize screenSize = [UIScreen mainScreen].bounds.size;
2829

2930
UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, screenSize.height / 2)];
30-
UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, screenSize.height / 2, screenSize.width, screenSize.height / 2)];
31+
SDAnimatedImageView *imageView2 = [[SDAnimatedImageView alloc] initWithFrame:CGRectMake(0, screenSize.height / 2, screenSize.width, screenSize.height / 2)];
3132

3233
[self.view addSubview:imageView1];
3334
[self.view addSubview:imageView2];
@@ -43,10 +44,9 @@ - (void)viewDidLoad
4344
});
4445
}
4546
}];
46-
[imageView2 sd_setImageWithURL:HDRAVIFURL completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
47-
// 10-bit HDR
47+
[imageView2 sd_setImageWithURL:animatedAVIFSURL completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
4848
if (image) {
49-
NSLog(@"HDR AVIF load success");
49+
NSLog(@"Animated AVIFS load success");
5050
}
5151
}];
5252
// Do any additional setup after loading the view, typically from a nib.

Example/SDWebImageAVIFCoder_Example macOS/ViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ - (void)viewDidLoad {
1717

1818
SDImageAVIFCoder *AVIFCoder = [SDImageAVIFCoder sharedCoder];
1919
[[SDImageCodersManager sharedManager] addCoder:AVIFCoder];
20-
NSURL *AVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/AOMediaCodec/av1-avif/master/testFiles/Microsoft/kids_720p.avif"];
21-
NSURL *HDRAVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/AOMediaCodec/av1-avif/master/testFiles/Microsoft/Chimera_10bit_cropped_to_1920x1008.avif"];
20+
NSURL *AVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/fox.profile0.8bpc.yuv420.avif"];
21+
// NSURL *HDRAVIFURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/hato.profile2.12bpc.yuv422.avif"];
22+
NSURL *animatedAVIFSURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/link-u/avif-sample-images/master/star-12bpc-with-alpha.avifs"];
2223

2324
CGSize screenSize = self.view.bounds.size;
2425

2526
UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, screenSize.width / 2, screenSize.height)];
2627
imageView1.imageScaling = NSImageScaleProportionallyUpOrDown;
2728

28-
UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(screenSize.width / 2, 0, screenSize.width / 2, screenSize.height)];
29+
SDAnimatedImageView *imageView2 = [[SDAnimatedImageView alloc] initWithFrame:CGRectMake(screenSize.width / 2, 0, screenSize.width / 2, screenSize.height)];
2930
imageView2.imageScaling = NSImageScaleProportionallyUpOrDown;
3031

3132
[self.view addSubview:imageView1];
@@ -42,10 +43,9 @@ - (void)viewDidLoad {
4243
});
4344
}
4445
}];
45-
[imageView2 sd_setImageWithURL:HDRAVIFURL completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
46-
// 10-bit HDR
46+
[imageView2 sd_setImageWithURL:animatedAVIFSURL completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
4747
if (image) {
48-
NSLog(@"HDR AVIF load success");
48+
NSLog(@"Animated AVIFS load success");
4949
}
5050
}];
5151
}

Example/Screenshot/AVIFDemo-iOS.png

-1.44 MB
Loading

Example/Screenshot/AVIFDemo-macOS.png

-326 KB
Loading

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
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/AOMediaCodec/libavif) codec.
1313

14-
This AVIF coder plugin currently support AVIF still image **decoding**. Including alpha channel, as well as 10bit/12bit/16bit HDR images.
14+
This AVIF coder plugin support AVIF still image. Including alpha channel, as well as 10bit/12bit/16bit HDR images.
15+
16+
And, the new 0.9.0+ version add the support for AVIF sequence animated image! Including alpha channel, as well as 10bit/12bit/16bit HDR images.
1517

1618
The AVIF encoding is also supported now. Which always encode as 8-bit depth images.
1719

20+
See the demo for the more showcase.
21+
1822
## Note
1923

2024
AVIF image spec is still in evolve. And the current upstream AVIF codec is a simple implementation. The encoding time may be long for large images.

0 commit comments

Comments
 (0)