Home

Awesome

SDWebImageFLIFCoder

CI Status Version License Platform Carthage compatible

What's for

This is a SDWebImage coder plugin to add Free Lossless Image Format support. Which is built based on the open-sourced libflif codec.

This FLIF coder plugin support static FLIF and animated FLIF image decoding and encoding.

Requirements

Installation

CocoaPods

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

pod 'SDWebImageFLIFCoder'

Carthage

SDWebImageFLIFCoder is available through Carthage. Which use libflif as dynamic framework.

github "SDWebImage/SDWebImageFLIFCoder"

Usage

To use FLIF coder, you should firstly add the SDWebImageFLIFCoder to the coders manager. Then you can call the View Category method to start load FLIF images.

SDImageFLIFCoder *FLIFCoder = [SDImageFLIFCoder sharedCoder];
[[SDImageCodersManager sharedManager] addCoder:FLIFCoder];
UIImageView *imageView;
[imageView sd_setImageWithURL:url];
let FLIFCoder = SDImageFLIFCoder.shared
SDImageCodersManager.shared.addCoder(FLIFCoder)
let imageView: UIImageView
imageView.sd_setImage(with: url)

SDWebImageFLIFCoder also support FLIF encoding. You can encode UIImage to FLIF compressed image data.

UIImage *image;
NSData *imageData = [image sd_imageDataAsFormat:SDImageFormatFLIF];
let image;
let imageData = image.sd_imageData(as: .FLIF)

Screenshot

<img src="https://raw.githubusercontent.com/SDWebImage/SDWebImageFLIFCoder/master/Example/Screenshot/FLIFDemo.png" width="300" /> <img src="https://raw.githubusercontent.com/SDWebImage/SDWebImageFLIFCoder/master/Example/Screenshot/FLIFDemo-macOS.png" width="600" />

These FLIF images are from Phew, you can try the demo with your own FLIF image as well.

Author

DreamPiggy

Thanks

libflif Phew

License

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