SDWebImageFLIFCoder
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
- iOS 9.0
- macOS 10.11
- tvOS 9.0
- watchOS 2.0
- Xcode 11
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.
- Objective-C
SDImageFLIFCoder *FLIFCoder = [SDImageFLIFCoder sharedCoder];
[[SDImageCodersManager sharedManager] addCoder:FLIFCoder];
UIImageView *imageView;
[imageView sd_setImageWithURL:url];
- Swift
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.
- Objective-C
UIImage *image;
NSData *imageData = [image sd_imageDataAsFormat:SDImageFormatFLIF];
- Swift
let image;
let imageData = image.sd_imageData(as: .FLIF)
Screenshot
These FLIF images are from Phew, you can try the demo with your own FLIF image as well.
Author
DreamPiggy
Thanks
License
SDWebImageFLIFCoder is available under the MIT license. See the LICENSE file for more info.