Skip to content

Repository files navigation

WebPEncoder

Swift WebP Encoder

This library using libwebp.

Requirements

  • Development with Xcode 26.2+
  • Written in Swift 6.2
  • swift-tools-version: 6.2
  • Compatible with macOS 14.0+

Usage

import AppKit
import WebPEncoder
guardlet url =Bundle.module.url(forResource:"sample", withExtension:"jpg"),let nsImage =NSImage(contentsOf: url),let cgImage = nsImage.cgImage(forProposedRect:nil, context:nil, hints:nil)else{return}do{letwebpData=tryWebPEncoder().encode(cgImage, config:.preset(.picture, quality:0.8, multithread:false))
webpData.write(to: saveURL)}catch{print(error.localizedDescription)}

Privacy Manifest

This library does not collect or track user information, so it does not include a PrivacyInfo.xcprivacy file.

About

Swift WebP Encoder

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages