4 ms·
I had to look this week for a faster/lighter png encoder in cpp, couldn’t find any alternatives to libpng.
by a_t48 2y ago
I had to look this week for a faster/lighter png encoder in cpp, couldn’t find any alternatives to libpng.
- toastie_toastie 2y agostb_image is a single header image encoder/decoder that is used pretty widely across game development codebases. and it supports a ton of different formats. https://github.com/nothings/stb https://github.com/nothings/stb
- a_t48 2y agoThe main page implies it only does decoding, am I reading it wrong? Edit: stb_image_write exists, I was reading it wrong
- deleted 2y ago[deleted]
- mmozeiko 2y agohttps://github.com/veluca93/fpnge https://github.com/veluca93/fpnge is a very fast png encoder. A bit lower compression ratio, but runs significantly faster than alternatives. Here is a presentation with benchmarks: https://www.lucaversari.it/FJXL_and_FPNGE.pdf https://www.lucaversari.it/FJXL_and_FPNGE.pdf
- a_t48 2y agoThis looks right up my alley, thanks! Will give it a shot.
- a_t48 2y agoThis worked out for me. What I was actually interested in was reducing CPU utilization, which generally speed is a fine substitute for (the same work being done in a smaller time slice means lower overall utilization). It reduced utilization enough that I'll likely push to use it for production in the future (not immediately, there's bigger low hanging fruit).
- masklinn 2y agolibsnpng is pure C. And it doesn't look like the png crate provides a C API but if your usage is not overly complex it might be easy enough to byo?