A simple, secure, and high-performance C library for reading and writing PNG files, designed as a modern alternative to libpng.
libspng is a C library for reading and writing PNG (Portable Network Graphics) files. It focuses on providing a secure, simple, and high-performance alternative to libpng, with a cleaner API and robust error handling. The library handles common PNG operations like decoding, encoding, gamma correction, and progressive image reading while prioritizing safety and correctness.
C/C++ developers working with PNG images in applications where security, performance, and maintainability are critical, such as image processing tools, game engines, or embedded systems.
Developers choose libspng over libpng for its simpler API, better performance in typical use cases, and strong security posture with continuous fuzzing and adherence to CERT C standards. It reduces complexity without sacrificing features.
Simple, modern libpng alternative
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Continuously fuzzed via OSS-Fuzz and written per CERT C standards, ensuring no known security bugs, which is critical for secure applications.
Provides straightforward functions like spng_decode_image, reducing complexity compared to libpng's verbose interface, as shown in the usage example.
Outperforms libpng in common use cases while maintaining correctness, evidenced by performance benchmarks in the README.
Can be built with miniz instead of zlib, reducing external dependencies and easing integration in constrained environments.
Supports all standard PNG chunks, gamma correction, and stream decoding, covering most PNG needs as per the features table.
Known issues admit that decoding to formats like SPNG_FMT_G8 is not supported for all PNG color type and bit depth combinations, restricting some use cases.
Animated PNG is only planned, not implemented, making it unsuitable for applications requiring APNG, unlike libpng which supports it with a patch.
Versioning notes indicate that 1.0.0 might introduce breaking changes (though planned to be compatible), creating uncertainty for long-term stability.
As a newer library, it has less community support, documentation, and third-party integrations compared to the established libpng.
Libspng is an open-source alternative to the following products: