Jono, see this: https://github.com/OpenImageIO/oiio/pull/1167

This adds a set_pixels (and in the Python binding, it takes either a tuple or a 
Python array). It's probably not super efficient (ick, there's an intermediate 
copy to a std::vector involved), but it's a start.

I'm not experienced enough with numpy to know; how would you want the Python 
API to look to be most efficient for your purposes?

        -- lg


On Jun 4, 2015, at 4:24 PM, Jonathan Gibbs <[email protected]> wrote:

> Does anyone have a good/simple example of working with OIIO in python. I can 
> get at the raw pixels nicely enough with ImageBuf.get_pixels(), but it's not 
> clear the best way to get those pixels back into an ImageBuf for writing.  
> (There is no set_pixels.)
> 
> As a side note, get_pixels returns a Python array, which I can convert easily 
> enough to a numpy.ndarray. Is there a better way to get from a ImageBuf to a 
> numpy.ndarray and back again in a reasonably efficient manner?
> 
> --jono
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]



_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to