From a65d37c01ab97b17f100300bff4878772f21075d Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 18 Jan 2020 12:41:46 +0800 Subject: [PATCH] Update the Readme about thumbnail decoding. --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 00875c3..b510e3d 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,26 @@ let webpData: Data 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 + Objective-c