APNG to GIF Converter
Convert animated PNG (APNG) files to GIF format online. Client-side processing with color quantization, dithering, and frame timing preservation.
Drop your .apng file here
or click to browse · Max 50 MB
Parsing APNG...
About
APNG (Animated Portable Network Graphics) offers superior color depth and alpha transparency over GIF, but remains unsupported in many legacy systems, email clients, and CMS platforms. Converting APNG to GIF without proper frame-timing extraction produces broken animations or static fallback images. This tool parses the APNG binary structure at the chunk level - extracting acTL, fcTL, and fdAT chunks per the PNG specification (ISO/IEC 15948) - then reconstructs each frame on a Canvas. Color depth drops from 32-bit RGBA to an indexed 256-color palette via Median Cut quantization with optional Floyd - Steinberg dithering. Frame delays are preserved by mapping APNG's rational delay (delay_numdelay_den) to GIF's centisecond units. All processing runs locally in your browser. No files leave your device.
Formulas
Frame delay conversion from APNG rational time to GIF centisecond units:
Where delay_num and delay_den are unsigned 16-bit integers from the fcTL chunk. When delay_den = 0, the spec defines it as 100 (i.e., delay in centiseconds directly). Minimum GIF delay is clamped to 2 centiseconds to prevent browser speed-capping behavior.
Median Cut quantization reduces the color space iteratively:
Repeated until 256 buckets exist. Each bucket's mean RGB becomes one palette entry. Floyd - Steinberg dithering distributes quantization error e to neighboring pixels with weights 716, 316, 516, 116.
LZW compression for GIF uses variable-width codes starting at minCodeSize + 1 bits (typically 9 bits for an 8-bit palette), growing up to 12 bits, with clear code = 2minCodeSize and EOI code = clear code + 1.
Reference Data
| Property | APNG | GIF (GIF89a) |
|---|---|---|
| Max Colors | 16.7M (24-bit) + alpha | 256 per frame (indexed) |
| Transparency | Full 8-bit alpha channel | Binary (1-bit on/off) |
| Color Depth | 32-bit RGBA | 8-bit indexed |
| Compression | DEFLATE (lossless) | LZW (lossless, indexed) |
| Spec / Standard | Mozilla extension of PNG | CompuServe GIF89a (1990) |
| Browser Support | Modern browsers (no IE) | Universal |
| Email Client Support | Minimal | Universal |
| Looping Control | num_plays in acTL | Netscape App Extension |
| Frame Delay Unit | Rational: numden seconds | Centiseconds (1/100 s) |
| Max Frame Delay | Unlimited | 655.35 s |
| Dispose Operations | None / Background / Previous | None / Background / Previous |
| Blend Operations | Source / Over | N/A (replace only) |
| Interlacing | Adam7 supported | Row interlace supported |
| Typical File Size | Smaller at equal quality | Larger (no alpha, LZW overhead) |
| Mime Type | image/apng or image/png | image/gif |
| File Signature | 89 50 4E 47 (PNG) | 47 49 46 38 39 61 |
| Animation Indicator | acTL chunk present | Multiple image blocks |
| Dithering Need | Not required | Recommended for gradients |