A WebP coder plugin for SDWebImage, use libwebp
Go to file
DreamPiggy ead68a0e31
Merge pull request #9 from SDWebImage/bugfix_encoding_first_frame
Fix the issue when provide a `UIAnimatedImage` and encode it into a static WebP failed
2019-01-28 17:21:42 +08:00
Example Update the README and example to the latest version, show SDAnimatedImageView usage 2019-01-28 00:01:10 +08:00
SDWebImageWebPCoder Fix the issue when provide a `UIAnimatedImage` and encode it into a static WebP failed. Add a backup check of image.images 2019-01-28 14:50:34 +08:00
SDWebImageWebPCoder.xcodeproj Remove the extra SD_WEBP macro define. Since now we move to a dedicated repo 2018-09-17 20:43:32 +08:00
SDWebImageWebPCoder.xcworkspace Fix the issue of wrong workspace group 2019-01-11 18:32:18 +08:00
SDWebImageWebPCoderTests Fixed Travis CI by removing the double linking from SDWebImageWebPCoderTests to SDWebImageWebPCoder (one via CocoaPods and the other one direct) 2018-09-08 21:39:39 +03:00
.gitignore Initial checkin of the project - minimal code + docs + Travis CI script 2018-08-28 18:21:20 +03:00
.travis.yml Fixed Travis CI by removing the double linking from SDWebImageWebPCoderTests to SDWebImageWebPCoder (one via CocoaPods and the other one direct) 2018-09-08 21:39:39 +03:00
Cartfile Update the CocoaPods && Carthage dependency to upstream SDWebImage 5.0.0-beta4. Bumped version to 0.1.1 2019-01-26 18:35:21 +08:00
Cartfile.resolved Update the CocoaPods && Carthage dependency to upstream SDWebImage 5.0.0-beta4. Bumped version to 0.1.1 2019-01-26 18:35:21 +08:00
LICENSE Initial checkin of the project - minimal code + docs + Travis CI script 2018-08-28 18:21:20 +03:00
README.md Update the README and example to the latest version, show SDAnimatedImageView usage 2019-01-28 00:01:10 +08:00
SDWebImageWebPCoder.podspec Update the CocoaPods && Carthage dependency to upstream SDWebImage 5.0.0-beta4. Bumped version to 0.1.1 2019-01-26 18:35:21 +08: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 = [UIImage sd_imageDataAsFormat:SDImageFormatWebP];
  • 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 = image.sd_imageData(asFormat: .WebP)

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.