Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Supports WebP/Animated WebP nativally for iOS 14/macOS 11/tvOS 14/watchOS 7 without extra libwebp dependency #3041

Closed
3 tasks done
dreampiggy opened this issue Jun 23, 2020 · 3 comments · Fixed by #3048
Labels
ImageIO Anything related to Apple ImageIO codec WebP

Comments

@dreampiggy
Copy link
Contributor

dreampiggy commented Jun 23, 2020

New Issue Checklist

Issue Description and Steps

Image/IO in iOS 14/macOS 14/tvOS 11/watchOS 7 supports WebP (including Animated WebP) nativally. See full changelog: http://codeworkshop.net/objc-diff/sdkdiffs/ios/14.0/ImageIO.html

It's easy and right time to drop the libwebp for user who set minimun deployment target version to iOS 14+.

ImageIO use hardware-accelerated codec instead of that libwebp (which is written in C and run on CPU), is much faster than the current WebP codecs on iOS 13.

Design

Introduce the new subclass for AWebP: SDImageAWebPCoder. The SDImageWebPCoder naming already been taken by another codec repo maintained by us. So this a new naming.

In the future (2 Years later ?), that SDWebImageWebPCoder repo may be deprecated.

Note: For Static WebP, you don't need to add SDImageAWebPCoder, the SDImageIOCoder already handle those cases.

Usage

For iOS 14+ user, you can use avaiable check to use the native WebP support. For iOS 13-, use the fallback version of libwebp support.

if (@available(iOS 14, macOS 11, tvOS 14, watchOS 7, *)) {
    [SDImageCodersManager.sharedManager addCoder:SDImageAWebPCoder.sharedCoder];
} else {
    [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder];
}
@dreampiggy dreampiggy added WebP ImageIO Anything related to Apple ImageIO codec labels Jun 23, 2020
@caoping
Copy link

caoping commented Jun 28, 2020

Great News

@dreampiggy
Copy link
Contributor Author

dreampiggy commented Jul 1, 2020

Seems Apple's ImageIO framework already vendor the libwebp source code:

image

Also, they directly call the libwebp API for decoding:

image

@dreampiggy
Copy link
Contributor Author

Bad news: confirms that current iOS 14 Beta, does not supports WebP Encoding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ImageIO Anything related to Apple ImageIO codec WebP
Projects
None yet
2 participants