Animated PNGs

Animated PNGs

2月 28, 2025 · 1 分钟阅读时长 · 163 字 · -阅读 -评论

While using Tencent Docs today, I noticed this VIP badge image. The URL ends with .png, yet it’s animated. I always thought PNGs were static, so I dug around and learned that PNGs can, in fact, be animated. Here’s a quick summary to fill that knowledge gap.

Animated PNGs

The proper term is APNG.

  1. The file extension remains .png.
  2. The MIME type is still image/png.
  3. PNG supports a transparent channel.

In other words, you can’t distinguish static PNGs from animated ones just by looking at the file metadata.

PNG vs. WebP

Besides PNG, we often use WebP for animated images. WebP files tend to be smaller, so if the browser supports it, WebP is usually the better choice.

Example

Let’s compare the Tencent Docs VIP badge in both formats.

WebP

PNG

Note: Tencent Docs auto-negotiates the best format. So even though the URL ends in .png, modern browsers receive WebP data behind the scenes.

Final Thoughts

That’s a quick primer on animated PNGs.

Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源