Swift Wrapper of libwebp
Currently, this is very experimental project. Please feedback me!
Support Versions:
- libwebp: v1.0.0
- iOS Deployment Target: 8.0
- macOS Deployment Target: 10.11
- support macOS build
- support iOS build
- Advanced Encoder API: WebPEncoder, WebPEncoderConfig
- Simple Decoding API: WebPSimple#decode(...) <= will remove
will implement following features
- support Linux build
- Advanced Decoding API
- Progressively decoding option
let image = UIImage(named: "demo")
let encoder = WebPEncoder()
let queue = DispatchQueue(label: "me.ainam.webp")
// should encode in background
queue.async {
let data = try! encoder.encode(image, config: .preset(.picture, quality: 95))
// using webp binary data...
}Please check example projects
No need the requirement about libwebp for yourself, this framework contains it.
This library won't support CocoaPods. It's difficult to create and maintain podspec files for static libraries. (But contribution for that is always welcome.)
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthageTo integrate WebP into your Xcode project using Carthage, specify it in your Cartfile:
github "ainame/Swift-WebP"
Run carthage update --use-submodules to build the framework and drag the built `WebP.framework** into your Xcode project.
Don't forget to use --use-submodules flag!
ainame
Swift-WebP is available under the MIT license. See the LICENSE file for more info.