richgel999/fpng
FreeSuper fast C++ .PNG writer/reader
About richgel999/fpng
fpng is a high-performance C++ library for reading and writing PNG images, specifically optimized for 24-bit (RGB) and 32-bit (RGBA) images. It is a single source file with no external dependencies, making it easy to integrate into any C++ project. The encoder uses Length-Limited Prefix Codes to achieve compression speeds 12-19x faster than stb_image_write.h while producing files 5-11% smaller on average. The decoder is 2.5-3x faster than stb_image.h and libpng when reading fpng-compressed PNGs. The library is fully compliant with the PNG standard and has been validated against libpng, wuffs, lodepng, stb_image, and pngcheck. It supports both 1-pass (fastest) and 2-pass (better compression) encoding modes. fpng is open source under an MIT-like license and can be built with Visual Studio or CMake on Windows, Linux, and macOS.
Key Features
Pros & Cons
- Exceptional compression and decompression speed compared to popular libraries
- Single-file, dependency-free integration
- Open source and freely available
- Produces standard PNG files readable by any PNG decoder
- Actively maintained with benchmarks demonstrating clear performance advantages
- Compression ratio typically lower than lodepng and libpng (less compact files)
- Only supports 24/32bpp images; no grayscale, 8-bit palette, or other color types
- Benchmarks primarily on x86/x64 with SSE optimizations; performance on other architectures may vary
- Small community compared to larger libraries like libpng