Update the Readme about thumbnail decoding.

This commit is contained in:
DreamPiggy 2020-01-18 12:41:46 +08:00
parent d77570d623
commit a65d37c01a
1 changed files with 20 additions and 0 deletions

View File

@ -124,6 +124,26 @@ let webpData: Data
let image = SDImageWebPCoder.shared.decodedImage(with: data, options: nil) let image = SDImageWebPCoder.shared.decodedImage(with: data, options: nil)
``` ```
### Thumbnail Decoding
+ Objective-C
```objective-c
// WebP thumbnail image decoding
NSData *webpData;
CGSize thumbnailSize = CGSizeMake(300, 300);
UIImage *thumbnailImage = [[SDImageWebPCoder sharedCoder] decodedImageWithData:webpData options:@{SDImageCoderDecodeThumbnailPixelSize : @(thumbnailSize}];
```
+ Swift
```swift
// WebP thumbnail image decoding
let webpData: Data
let thumbnailSize = CGSize(width: 300, height: 300)
let image = SDImageWebPCoder.shared.decodedImage(with: data, options: [.decodeThumbnailPixelSize: thumbnailSize])
```
### Encoding ### Encoding
+ Objective-c + Objective-c