hello I wanted to use openimageio cpp library for some basic image writing with cython.
I quickly realized I was over my head, here is a basic example from the documentation.
#include <OpenImageIO/imageio.h>
int main()
{
const char *filename = "foo.jpeg";
const int xres = 640, yres = 480;
const int channels = 3; // RGB
unsigned char pixels[xres*yres*channels];
OpenImageIO::ImageOutput *out = OpenImageIO::ImageOutput::create (filename);
if (! out)
return false;
OpenImageIO::ImageSpec spec (xres, yres, channels, OpenImageIO::TypeDesc::UINT8);
out->open (filename, spec);
out->write_image (OpenImageIO::TypeDesc::UINT8, pixels);
out->close ();
delete out;
}
I have spent an embarrassing amount of time trying to work out how to duplicate this example with cython/python. They do provide a python api which works well, but as I only want to write images with it I thought i would try to wrap the image writing part. I would welcome any examples untested even :) . My attempts have led me in circles