Simple, modern libpng alternative
Bugfixes
example.c
for valid imagesspng__zalloc()
Changes
Changes to the default behavior were made for libpng compatibility:
This release is backward compatible.
New
Progressive image decode support, added new functions:
spng_decode_scanline()
- Decodes a single scanlinespng_decode_row()
- Decodes and deinterlaces a scanlinespng_get_row_info()
- Get current scanline, row informationAdded support for reading tEXt, iTXt, zTXt and iCCP color profile chunks, all standard chunks are supported in this release.
Added support for building with miniz, spng.c/h
and miniz.c/h
can be used together without additional dependencies
Added output format SPNG_FMT_PNG
, it represents the PNG's format in host-endian (thanks to Matthew Stadelman for initial implementation)
Added output format SPNG_FMT_RAW
, it represents the PNG's format in big-endian (Matthew Stadelman)
Added output format SPNG_FMT_RGB8
, conversion is supported from any color type and bit depth
Added grayscale output formats SPNG_FMT_G8
, SPNG_FMT_GA8
and SPNG_FMT_GA16
, in this release conversion is only supported from a subset of grayscale and bit depth combinations, see documentation for details
Added support for decoding from a FILE*
with spng_set_png_file()
Added SPNG_CTX_IGNORE_ADLER32
context flag to ignore checksums in DEFLATE streams
Added enums for filter types and interlace method
Added Meson option use_miniz
and compiler option SPNG_USE_MINIZ
for building with miniz
Added Meson option benchmarks
to run benchmarks provided by spngt, this requires Git LFS.
Added Meson option static_zlib
to link the static version of zlib
Multiversioned defilter_up()
function (enabled for GCC + glibc)
Changes
spng_decode_image()
takes a void*
for the output buffer (was unsigned char*
)
Reaching chunk size- or cache limits is now handled as an out-of-memory error
Out-of-range palette indices are handled as black opaque pixels when decoding, this matches libpng's default behavior
PNG image row length and output row length is now limited to 2^32-1 (UINT32_MAX
)
Bugfixes
Known issues
SPNG_FMT_G8
, SPNG_FMT_GA8
and SPNG_FMT_GA16
output formats is not supported for all PNG color type and bit depth combinations, see documentation for detailsSPNG_FMT_PNG
, SPNG_FMT_G8
, SPNG_FMT_GA8
and SPNG_FMT_GA16
spng_crc_set_action()
is partially implemented, SPNG_CRC_DISCARD
has no effectThis is a release candidate, the API may change for the stable release! Share your feedback on the API here or on Gitter!
UPDATE: This release is broken, use https://github.com/randy408/libspng/commit/a0b7323558e0f45e899cd7b5f8ddde2e18c9709e for testing progressive decode functionality with SPNG_FMT_PNG
.
New features:
spng_decode_scanline()
- decodes a single scanlinespng_decode_row()
- decodes and deinterlaces a scanlinespng_get_row_info()
- get scanline/row info including the filter typeSPNG_FMT_RGB8
, conversion is supported from any color type and bit depthSPNG_FMT_PNG
, this always matches the PNG's format in host-endianFILE*
via spng_set_png_file()
SPNG_CTX_IGNORE_ADLER32
context flag to ignore checksums in DEFLATE streamsbenchmarks
to run benchmarks provided by spngt, this requires Git LFS.static_zlib
defilter_up()
function (enabled for GCC + glibc)Documentation:
Bugfixes: