Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

cysp/STWebPDecoder

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
lib
 
 
libwebp-test-data @ 62d4369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

STWebPDecoder

A simple wrapper for libwebp, providing a simple interface to decode WebP image data for use in iOS / Mac applications.

NSString * const webpPath = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"webp"];
NSData * const webpData = [[NSData alloc] initWithContentsOfFile:webpPath options:NSDataReadingMappedIfSafe error:NULL];
self.imageView.image = [STWebPDecoder imageWithData:webpData scale:2 error:NULL];

STWebPURLProtocol

More interestingly, this class allows transparent use of WebP images inside UIWebViews.

[STWebPURLProtocol registerWithOptions:@{ STWebPURLProtocolOptionClaimWebPExtension: @YES }];

[self.webView loadHTMLString:@"<img src=\"https://www.gstatic.com/webp/gallery3/2_webp_ll.webp\">" baseURL:nil];

About

A simple Cocoa wrapper for libwebp

Resources

License

Stars

Watchers

Forks