Swift WebP Encoder
This library using libwebp.
- Development with Xcode 26.2+
- Written in Swift 6.2
- swift-tools-version: 6.2
- Compatible with macOS 14.0+
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)}This library does not collect or track user information, so it does not include a PrivacyInfo.xcprivacy file.