A very fast single-file C++ PNG encoder/decoder for 24/32bpp images with no dependencies.
fpng is a specialized, high-speed C++ library for encoding and decoding PNG image files. It solves the problem of slow PNG compression and decompression in applications like game development or texture processing by offering a dramatically faster alternative to standard libraries while maintaining full file compatibility.
C/C++ developers working on performance-critical applications involving PNG images, such as game engines, real-time graphics tools, texture pipelines, or embedded systems where fast image I/O is essential.
Developers choose fpng for its exceptional speed, simplicity of integration (single file, no dependencies), and its unique ability to decode its own optimized PNGs much faster than general-purpose libraries, all while producing fully standard-compliant files.
Super fast C++ .PNG writer/reader
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Compresses PNGs 12-23x faster than libpng and stb_image_write with comparable or better file sizes, as shown in benchmarks using real-world image sets.
Decodes its own PNGs 2.5-3x faster than general-purpose libraries by using length-limited prefix codes and a tailored parser, enabling rapid texture loading.
Entire library is contained in fpng.cpp and fpng.h with no external dependencies, making integration trivial for C++ projects.
Outputs valid PNG files readable by any standard decoder (e.g., libpng, stb_image), ensuring broad compatibility despite optimizations.
Only handles 24-bit and 32-bit RGB images, excluding common PNG formats like grayscale, indexed color, or animations, which reduces versatility.
The fast decoder only works on fpng-encoded PNGs; for others, it falls back with an error, requiring additional code to handle mixed sources.
Requires SSE 4.1 and PCLMUL for peak performance, and manual initialization with fpng::fpng_init(), adding complexity for cross-platform or non-x86 systems.