/WebP-UIImage

UIImage category to work with WebP image files in iOS.

Primary LanguageCMIT LicenseMIT

WebP-UIImage

UIImage category to work with WebP image files in iOS.

Installation

Drag and drop the Classes folder and WebP.framework into your project.

Usage

Getting started with WebP-UIImage is simple. Import framework #import "UIImage+WebP.h" and call following methods:

- (NSData *)dataWebPWithQuality:(float)quality;//quality = 0..100
+ (UIImage*)imageWithWebPAtPath:(NSString *)filePath;

+ (UIImage *)imageWithWebPData:(NSData *)imgData;
@property (nonatomic, readonly) NSData *dataWebPLossless;

- (BOOL)writeWebPToDocumentsWithFileName:(NSString *)filename quality:(float)quality;
- (BOOL)writeWebPLosslessToDocumentsWithFileName:(NSString *)filename;

Bonus

I made also an NSValueTransformer subclass called ImageToWebPDataTransformer. You can use it in CoreData to store images with less sizes than jpeg. I use 75 quality value as it is default Google value.

Thanks

The project is heavily based on nyteshade/iOSWebPWithAlphaExample

License

MIT

Tests

No speed/size tests were done. You can make your own and commit it here.