Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyome22/webpencoder
Swift WebP Encoder
https://github.com/kyome22/webpencoder
Last synced: about 1 month ago
JSON representation
Swift WebP Encoder
- Host: GitHub
- URL: https://github.com/kyome22/webpencoder
- Owner: Kyome22
- License: mit
- Created: 2024-11-17T15:24:08.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-18T09:16:29.000Z (about 1 month ago)
- Last Synced: 2024-11-18T10:22:59.413Z (about 1 month ago)
- Language: Swift
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebPEncoder
Swift WebP Encoder
## Requirements
- Development with Xcode 16.0+
- Written in Swift 6.0
- swift-tools-version: 6.0
- Compatible with macOS 14.0+## Usage
```swift
import AppKit
import WebPEncoderguard let 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 {
let webpData = try WebPEncoder().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.