# 远程动画PNG失去动画

**URL:** <https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435>\
**Category:** Feature\
**Tags:** uploads, pr-welcome\
**Created:** [2023年八月24日 12:43 UTC](https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435 "2023-08-24T12:43:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年八月24日 12:43 UTC](https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435/1 "2023-08-24T12:43:56Z")

</div>

Discourse 中热链接的 APNG 动画不播放：

如果 `download remote images to local` 设置为 `true`，下载到服务器后动画也会丢失。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2023年八月24日 13:42 UTC](https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435/2 "2023-08-24T13:42:17Z")

</div>

> [@Canapin](#):
>
> APNG 动画在 Discourse 中通过热链接时无法播放：

Discourse 不支持 APNG。我们唯一支持的动画图像格式是 GIF、WEBP 和 AVIF。

如果有人希望参与此功能开发，您需要对核心代码进行补丁修改，因为我们在前端和后端都会跳过许多针对动画图像的优化，同时还需要在 fastimage 库中编写一个二进制 APNG 检测器。

已移至 #Contribute > Feature request 并添加 #pr-welcome。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2023年九月12日 17:48 UTC](https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435/3 "2023-09-12T17:48:28Z")

</div>

我刚发现 Steam 正在为其动画贴纸使用 APNG，这是我们应该为其添加支持的另一个迹象。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2023年九月13日 16:27 UTC](https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435/5 "2023-09-13T16:27:52Z")

</div>

您能分享一些 APNG 供我测试此功能吗？

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2023年九月13日 21:36 UTC](https://meta.discourse.org/t/remote-animated-png-lose-their-animation/276435/7 "2023-09-13T21:36:52Z")

</div>

我在我的 [PR](https://github.com/sdsykes/fastimage/pull/148) 中为 FastImage 提供了初步支持：

> <https://github.com/sdsykes/fastimage/blob/2201122ce42ac9aaa552f2302b2d999fc99437c4/lib/fastimage.rb#L1118-L1131>

如果这个 PR 被合并，Discourse 将自动支持动态 PNG。
