A Swift WebP Decoder and Encoder for UIKit UIImage.
- Encode UIImage/PNG data to WebP data.
- Decode WebP data to UIImage.
File > Swift Packages > Add Package Dependency Add - Add https://github.com/alfianlosari/SwiftWebP.git
import SwiftWebP
if let webPData = WebPEncoder().encodePNG(data: outputPngData) {
// use your webP data
}
if let webPData = WebPEncoder().encode(image: myUIImage) {
// use your webP data
}
if let images = WebPDecoder().decode(data: webpData) {
// images type is array [UIImage]
}