目录
目录README.md

webp.swift

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))
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号