同步操作将从 Gitee 极速下载/libspng 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
libspng is a C library for reading and writing Portable Network Graphics (PNG) format files with a focus on security and ease of use.
libspng is an alternative to libpng, the projects are separate and the APIs are not compatible.
The goal is to provide a fast PNG library with a simpler API than libpng.
Feature | libspng | libpng | stb_image | lodepng |
---|---|---|---|---|
Decode to RGBA8/16 | ✓ | ✓ | ✓ | ✓ |
Decode from stream | ✓ | ✓ | ✓ | ❌ |
Gamma correction | ✓ | ✓ | ❌ | ❌ |
Fuzzed by OSS-Fuzz | ✓ | ✓ | ❌ | ✓ |
Progressive read | ❌* | ✓ | ❌ | ❌ |
Doesn't require zlib | ❌ | ❌ | ✓ | ✓ |
Encoding | ❌* | ✓ | ✓ | ✓ |
Animated PNG | ❌* | ✓** | ❌ | ❌ |
* Feature in planning phase
** With a 3rd party patch
Download the latest release and include spng.c/spng.h
in your project,
you can also build with CMake or Meson. Refer to the documentation for details.
/* Create a context */
spng_ctx *ctx = spng_ctx_new(0);
/* Set an input buffer */
spng_set_png_buffer(ctx, buf, buf_size);
/* Determine output image size */
spng_decoded_image_size(ctx, SPNG_FMT_RGBA8, &out_size);
/* Decode to 8-bit RGBA */
spng_decode_image(ctx, out, out_size, SPNG_FMT_RGBA8, 0);
/* Free context memory */
spng_ctx_free(ctx);
See example.c.
Code is licensed under the BSD 2-clause "Simplified" License.
The project contains optimizations and test images from libpng, these are licensed under the PNG Reference Library License version 2.
Code is written according to the rules of the CERT C Coding Standard. All integer arithmetic is checked for overflow and all error conditions are handled gracefully.
The library is continuously fuzzed by OSS-Fuzz, releases are scanned with Clang Static Analyzer, PVS-Studio, and Coverity Scan.
The test suite consists of over 700 test cases, 175 test images are decoded with all possible output format and flag combinations and compared against libpng for correctness.
Releases follow the semantic versioning scheme with a few exceptions:
Note that 1.0.0 will introduce little to no breaking changes.
Online documentation is available at libspng.org/docs.
spng_crc_set_action()
is partially implemented, SPNG_CRC_DISCARD
has no effect.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。