Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Complete WebP Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling
C Objective-C
branch: master

README.md

WebPImageSerialization

WebPImageSerialization encodes and decodes between UIImage and WebP image data, following the API conventions of Foundation's NSJSONSerialization class.

Keen on C functions, are you? Well, WebPImageSerialization provides functions as well, for creating a UIImage from data, and generating a WebP representation of an existing UIImage.

What's that? You'd prefer not to write any additional code? You're in luck! So long as you don't #define WEBP_NO_UIIMAGE_INITIALIZER_SWIZZLING, UIImage will natively support WebP image data, allowing you to treat it no differently than JPEG, GIF, PNG, or TIFF.

Usage

Decoding

UIImageView *imageView = ...;
imageView.image = [UIImage imageNamed:@"image.webp"];

Encoding

NSData *data = UIImageWebPRepresentation(imageView.image);

Contact

Mattt Thompson

License

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

Something went wrong with that request. Please try again.