Python apply .cube ?


tre...@...
 

Please help!
I am trying to load in a file, resize it, apply a .cube LUT then write it out.
I have the following so far, but I'm falling over between the oiio > ocio parts (one using an oiio.ImgBuf and the other using a pixel array)
Have I missed something ? Is there an easier way to apply a .cube LUT to an image.
Thanks for any pointers !
Trevor

    #load in file & resize
        origBuffer = oiio.ImageBuf(aFile)
        resizeBuffer = oiio.ImageBuf(oiio.ImageSpec (1920, 972, 3, oiio.FLOAT))
        oiio.ImageBufAlgo.resize(resizeBuffer, origBuffer)

        config = OCIO.Config()

        transform = OCIO.FileTransform(src = self.LUT, interpolation = self.interpolation, direction = OCIO.Constants.TRANSFORM_DIR_FORWARD)
        processor = config.getProcessor(transform)

        pixels=self.inputNode.get_pixels()
        img = processor.applyRGBA(pixels)
    img.write(outputPath)

Join ocio-dev@lists.aswf.io to automatically receive all group messages.