/SwiftWebP

Swift WebP Decoder/Encoder for UIImage

Primary LanguageObjective-CMIT LicenseMIT

SwiftWebP

A Swift WebP Decoder and Encoder for UIKit UIImage.

Features

  • Encode UIImage/PNG data to WebP data.
  • Decode WebP data to UIImage.

Installation

Swift Package Manager

File > Swift Packages > Add Package Dependency Add - Add https://github.com/alfianlosari/SwiftWebP.git

Libraries Used

Usage

Import it

import SwiftWebP

Encode PNG Data

if let webPData = WebPEncoder().encodePNG(data: outputPngData) {
    // use your webP data
}

Encode UIImage

if let webPData = WebPEncoder().encode(image: myUIImage) {
    // use your webP data
}

Decode WebP data

if let images = WebPDecoder().decode(data: webpData) {
    // images type is array [UIImage]
}