Swiftpack.co - awxkee/webp.swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by awxkee.
awxkee/webp.swift 1.0.4
Bindings for libwebp in swift for iOS and macOS + catalyst
⭐️ 11
🕓 41 weeks ago
iOS macOS macCatalyst
.package(url: "https://github.com/awxkee/webp.swift.git", from: "1.0.4")


What's This?

webp.swift the package to easy compress(decompress) WebP and Animated WebP images in Swift

How To Use

// Encode UIImage to WebP data
let encoded: Data = try WebPEncoder().encode(image, config: .preset(.picture, quality: 81))
// Decode Data to UIImage
var opts = WebpDecoderOptions()
let image: UIImage = try WebPDecoder().decode(toImage: data, options: opts)
// Encode animated
let encoder = WebPAnimatedEncoder()
try encoder.create(config: .preset(.picture, quality: 81), width: width, height: height)
try encoder.addImage(image: UIImage(), duration: duration)
let imageData: Data = try encoder.encode(loopCount: 0) // 0 - means infinity 
// Incremental decoding if necessary
let incrementalDecoder = WebpIncrementalDecoder()
let image: UIImage = try incrementalDecoder.incremetallyDecode(Data(count: 10))


Stars: 11
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.


Release Notes

41 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics