stb icon indicating copy to clipboard operation
stb copied to clipboard

stb_image: read image into a buffer allocated outside of stbi

Open attilaz opened this issue 9 years ago • 9 comments

It could be implemented to output into a preallocated buffer like in stb_image_resize or with the ability to set a custom allocator for output buffer alloc/free. I am not interested in using custom allocator for internal, temporary buffers but others might find that useful too.

attilaz avatar Dec 14 '14 09:12 attilaz

The current STBI_MALLOC in stb_image v2.0 is good enough for me. Thanks for adding it. So If you don't plan to modify the interface to add a preallocated buffer for output this issue can be closed.

attilaz avatar Dec 25 '14 18:12 attilaz

I still want to add that.

nothings avatar Dec 25 '14 19:12 nothings

Great. Thanks.

attilaz avatar Dec 26 '14 08:12 attilaz

I mentioned this in #435 but I'll repeat it here for prosperity

Providing a row stride with the buffer would then be very nice addition for the APIs that require aligned rows.

ratchetfreak avatar Mar 14 '17 20:03 ratchetfreak

I'm also interested in this, for reasons already mentioned in #435 (namely non-trivial row stride). Is this still on the todo list, or maybe available in a fork already somewhere?

fishcu avatar Mar 01 '19 16:03 fishcu

I'd be interested in this addition, too.

mokafolio avatar Mar 09 '19 21:03 mokafolio

I'm also interested in this. My game engine uses custom allocators everywhere and while I've done some hacks to STB image in order to accommodate, I think it would be nicer if it was exposed as part of the header by default.

kayomn avatar Apr 27 '20 09:04 kayomn

Adding my voice to the "I'm interested in this" as well. Really interested!

ronaaron avatar Aug 12 '20 05:08 ronaaron

This feature would be nice in Vulkan so that you may decode directly to the ppData parameter in vkMapMemory for a VkBuffer. This would reduce the amount of processing required. Otherwise the end-user will be forced to copy all data themselves to the mapped memory.

Karutoh avatar Nov 27 '21 02:11 Karutoh