RandyGaul / cute_headers

Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
4.24k stars 264 forks source link

cute_png.h: Saving a PNG to memory #316

Closed RicoP closed 1 year ago

RicoP commented 2 years ago

Similar to int cp_save_png(const char* file_name, const cp_image_t* img); it would be nice to have a void * cp_save_png_to_mem(const cp_image_t* img, int * outBytes); that saves png byte array to a memory buffer. This would be very useful on systems that don't have disk access or when I just want to send a png as a byte stream over a network connection.

RandyGaul commented 1 year ago

Sure thing we can add this! Did you want to submit a PR? I can do this as well, but a PR may be faster.

RicoP commented 1 year ago

I haven't done any code changes but I can look into it if you are busy

RandyGaul commented 1 year ago

https://github.com/RandyGaul/cute_headers/commit/0b2f66a0aff0d7e5db89c9d90554b96fd32c8457