This is a comparison between
libspng and the reference implementation
Lines of code
libspng is 2.8 kLOC while
libpng is ~10 kLOC without the encoder or 18 kLOC in total.
libspng does not have a configuration header, you only have to include
spng.c/spng.h in your project.
The API is a lot simpler, decoding a PNG file takes 6 function calls, there are no row pointers or callback functions involved.
All functions return zero on success and non-zero on error.
setjmp() for error handling,
this makes it difficult to use from other languages such as C++.
libspng has a clear way to request a specific output format, with
libpng the output format depends
on whether you set alpha filler bits, it also has weird defaults such as not converting 16-bit PNG's
to host endianness unless
png_set_swap() is called.
|Decode to RGBA8/16||✓||✓||✓||✓|
|Decode from stream||✓||✓||✓||❌|
|Fuzzed by OSS-Fuzz||✓||✓||❌||✓|
|Doesn't require zlib||❌||❌||✓||✓|
OSS-Fuzz improves code reliability with continuous, large-scale fuzz testing.
Third-party patch is available.