I think you are looking at it backwards. You don't pass the type of the pixels in the file and magically need to know what type of buffer to declare and allocate.
You declare and allocate whatever data type your program wants to work with, and the middle parameter tells OIIO what type of data you want, and it translates for you. So if you want float values (no matter what's stored in the actual file): float *out_pix = new float[w*h*channels]; src.get(roi, TypeDesc::FLOAT, out_pix); But instead, if you wanted 8 bit unsigned int values: unsigned char *out_pix = new unsigned char[w*h*channels]; src.get(roi, TypeDesc::UINT8, out_pix); And so on, for any of the types. > On Jul 1, 2020, at 8:46 AM, Sven Steinbauer <s...@themill.com> wrote: > > Apologies for the earlier empty email. I accidentally pressed send too early. > > What I would like to do is call > > > src.get_pixels(roi, TypeDesc::BASETYPE(spec.format.basetype), out_pix); > > However I am not sure how to declare `out_pix` as I cannot get the C type for > the basetype from a variable due to it being template functions. > What would be the correct way to declare out_pix from the specification's > basetype, if that is possible? > > > SVEN STEINBAUER​ > Senior R&D Engineer > T > +44 20 7287 4041 > <image930177.png> <http://www.themill.com/> > THE MILL 11‑14 WINDMILL STREET, LONDON, W1T 2JG > FOLLOW @MILLCHANNEL | FACEBOOK <http://www.facebook.com/millchannel> > | LINKEDIN <https://www.linkedin.com/company/9328> | > INSTAGRAM <https://www.instagram.com/millchannel> > | > THEMILL.COM <http://www.themill.com/> > > _______________________________________________ > Oiio-dev mailing list > Oiio-dev@lists.openimageio.org <mailto:Oiio-dev@lists.openimageio.org> > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org> -- Larry Gritz l...@larrygritz.com
_______________________________________________ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org