vn-verdnaturachat/ios/Pods/SDWebImageWebPCoder
Diego Mello 6a40d4cefb
[CHORE] Memory leaks investigation (#1675)
2020-02-17 16:06:18 -03:00
..
SDWebImageWebPCoder [CHORE] Memory leaks investigation (#1675) 2020-02-17 16:06:18 -03:00
LICENSE [CHORE] Update to react-native 0.60.4 (#1095) 2019-08-07 10:51:34 -03:00
README.md [CHORE] Update to react-native 0.60.4 (#1095) 2019-08-07 10:51:34 -03:00

README.md

SDWebImageWebPCoder

CI Status Version License Platform Carthage compatible

Starting with the SDWebImage 5.0 version, we moved the WebP support code and libwebp from the Core Repo to this stand-alone repo.

SDWebImageWebPCoder supports both WebP decoding and encoding, for Static WebP or Animated WebP as well.

Requirements

  • iOS 8
  • macOS 10.10
  • tvOS 9.0
  • watchOS 2.0

Installation

CocoaPods

SDWebImageWebPCoder is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SDWebImageWebPCoder'

Carthage

SDWebImageWebPCoder is available through Carthage.

github "SDWebImage/SDWebImageWebPCoder"

Usage

  • Objective-C
// Add coder
SDImageWebPCoder *webPCoder = [SDImageWebPCoder sharedCoder];
[[SDImageCodersManager sharedManager] addCoder:webPCoder];

// WebP image loading
UIImageView *imageView;
NSURL *webpURL;
[imageView sd_setImageWithURL:webpURL];

// WebP image encoding
UIImage *image;
NSData *webpData = [[SDImageWebPCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatWebP options:nil];
  • Swift
// Add coder
let WebPCoder = SDImageWebPCoder.shared
SDImageCodersManager.shared.addCoder(WebPCoder)

// WebP online image loading
let webpURL: URL
let imageView: UIImageView
imageView.sd_setImage(with: webpURL)

// WebP image encoding
let image: UIImage
let webpData = SDImageWebPCoder.shared.encodedData(with: image, format: .webP, options: nil)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

This is a demo to show how to use WebP and animated WebP images via SDWebImage.

Screenshot

These WebP images are from WebP Gallery and GIF vs APNG vs WebP

Author

Bogdan Poplauschi DreamPiggy

License

SDWebImageWebPCoder is available under the MIT license. See the LICENSE file for more info.