dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

[iOS] Animated WebP Support for iOS #25951

Open PeterMorrison250 opened 2 days ago

PeterMorrison250 commented 2 days ago

Description

MAUI supports animated GIFs through the Framework. Unfortunately, for iOS, MAUI does not natively support animated WebP images being rendered on the device.

On the native side, iOS has supported the required APIs for animated WebP images since iOS 14. These are very similar to the APIs used within MAUI to render animated GIFs.

Within the framework code, we would need to modify the ImageAnimationHelper.cs in order to not only check for "com.compuserve.gif" and its "GIFDictionary" data, but also check for "com.webmproject.webp" and its "WebPDictionary" data.

I have tested this locally and this will support extraction of WebP data, and utilise the same MAUI mechanism for constructing an animated UIImage object.

Public API Changes

The API would not need to change, as it is just internal processing of .webp images that would be changing.

Intended Use-Case

In my app, I am wanting to not only support GIF files (commonly distributed by sites such as tenor.com) but also WebP files (commonly distributed by sites such as giphy.com).