OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

[FEATURE REQUEST] ImageBuf "wrap" numpy array in python

Open lgritz opened this issue 1 year ago • 2 comments
trafficstars

In C++, it is straightforward to construct an ImageBuf that "wraps" an existing buffer without owning the memory, where you just give it the pointer to the memory and the strides.

There's not currently an equivalent in python, but there should be! It's a great idea suggested by a question from João Vítor Silva on the slack channel. We could imagine a Python-side IB constructor that takes a numpy ndarray and knows it's just a reference to that data and not to do any copies or ownership. (With the caveat that you need to ensure that you don't change the shape or where the data lives in the numpy array, because the IB that wraps it would have no way of knowing.)

lgritz avatar May 08 '24 16:05 lgritz

Hello @lgritz I am a newbie in this project, I can solve this issue, shall I work on this ? If no one are working on it previously

sumana-2705 avatar Jun 27 '24 12:06 sumana-2705

Yes, please do!

lgritz avatar Jun 27 '24 15:06 lgritz