Skip to content

image/apng MIME Type — Meaning, Usage & Examples

image/apng
Extensions: .apng, .png Class: image Spec: RFC 9649 (IANA registered)
View IANA registration ↗

image/apng means: image/apng is the media type for Animated PNG, an extension of PNG that adds frame-based animation while keeping full alpha transparency and lossless quality. APNG offers smoother, higher-quality animation than GIF without the 256-color limit. Image media types identify raster and vector graphics. The subtype selects the decoder and influences compression, transparency and animation support. Serving the right image type lets browsers pick efficient decoding paths, enables responsive srcset negotiation, and avoids the broken-image icon that appears when bytes and declared type disagree. You will encounter image/apng in contexts such as high-quality animated graphics with transparency; lossless animations where gif color limits hurt; stickers and ui animations needing crisp edges. It is commonly associated with the file extension(s) .apng, .png. APNG files often use the .png extension and degrade to a static first frame in non-supporting viewers, which is a graceful fallback. For broad animation support consider WebP or video; APNG shines when lossless quality and alpha are required.

Advertisement
Ad slot · ref-top

When you'll see image/apng

  • High-quality animated graphics with transparency
  • Lossless animations where GIF color limits hurt
  • Stickers and UI animations needing crisp edges

How to handle it

When serving images, match the Content-Type to the actual encoded bytes, set long-lived cache headers for immutable assets, and provide width/height or aspect-ratio hints to avoid layout shift. Use responsive delivery (srcset, picture, or server content-negotiation) so clients receive a format they support at an appropriate resolution. Validate uploaded images by decoding them, not by trusting the extension or the client-supplied type. As a final checklist for image types: compress and resize for the display slot, serve modern formats with fallbacks, add width and height to prevent layout shift, cache immutable assets aggressively, and validate uploads by decoding rather than trusting the claimed type or extension.

Notes & gotchas

APNG files often use the .png extension and degrade to a static first frame in non-supporting viewers, which is a graceful fallback. For broad animation support consider WebP or video; APNG shines when lossless quality and alpha are required.

Examples

HTTP
HTTP/1.1 200 OK
Content-Type: image/apng
Content-Disposition: inline; filename="sample.apng"

[binary image payload: the encoded bytes of a sample .apng]
curl
curl -i -H "Accept: image/apng" https://api.example.com/v1/resource   # inspect the returned Content-Type
JavaScript (fetch)
const res = await fetch("/media/sample.apng", { headers: { Accept: "image/apng" } });
const blob = await res.blob();            // blob.type should be "image/apng"
const url = URL.createObjectURL(blob);    // assign to img.src / audio.src / video.src
// revoke with URL.revokeObjectURL(url) when done to free memory
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource",
                   headers={"Accept": "image/apng"}, timeout=30)
res.raise_for_status()
assert res.headers["Content-Type"].startswith("image/apng")
with open("sample.apng", "wb") as fh:
    fh.write(res.content)   # raw bytes; use stream=True for large files

Frequently asked questions

Is APNG the same as PNG?

APNG extends PNG with animation chunks. A static PNG viewer shows the first frame, so it degrades gracefully. The registered type for animated content is image/apng.

Why choose APNG over GIF?

APNG keeps full 24-bit color and alpha transparency, avoiding GIF's 256-color banding and binary transparency. Files can be larger, but quality is markedly better for complex animation.

How do browsers choose between image formats?

Through the Accept header and srcset/sizes or the picture element. The server can content-negotiate (e.g. serve WebP/AVIF to clients that accept it), and the declared Content-Type must match the bytes actually sent.

Does the file extension determine the MIME type?

No — the server declares Content-Type, and the bytes must match it. Extensions are a convenience for mapping, but a .png file served as image/jpeg, or vice versa, can render incorrectly or be rejected by strict clients.

How do I prevent layout shift when images load?

Set explicit width and height attributes (or CSS aspect-ratio) so the browser reserves space before the image arrives, and use responsive srcset/sizes to deliver an appropriately sized file for each viewport.

Advertisement
Ad slot · ref-in-article

Try the Base64 Encoder

Encode and decode Base64 with UTF-8 and URL-safe options.

Open tool →