On Feb 21, 2022, at 3:22 PM, Jerome Raim <[email protected]> wrote:
>
> Larry, would you mind terribly boiler-plating some Python code on to create a
> single EXR with subimage 0 is RGB and subimage 1 is
> matte01,matte02,matte03,matte04 (ie combining the channels of the 2 matte
> EXRs).
In your original email, you said: out_filepath = '/tmp/exr.rexr'
"rexr" isn't a known extension, and that definitely will cause problems. But I
don't know if that was related to your real issues, or if it was just a typo in
your email.
But in any case, the following python script does what you asked:
#!/usr/bin/env python3
import OpenImageIO as oiio
comp_buf = oiio.ImageBuf("comp-test02-roiMisMatch.exr")
matte_buf = oiio.ImageBuf("matte-test02-roiMisMatch.exr")
matte2_buf = oiio.ImageBuf("matte2-test02-roiMisMatch.exr")
combined_matte_buf = oiio.ImageBufAlgo.channel_append(matte_buf, matte2_buf)
out_filepath = 'exr.exr'
out = oiio.ImageOutput.create (out_filepath)
if out is None :
print ("Could not create output file: ", oiio.geterror())
exit(1)
out.open(out_filepath, (comp_buf.spec(), combined_matte_buf.spec()))
comp_buf.write(out)
out.open(out_filepath, combined_matte_buf.spec(), "AppendSubimage")
combined_matte_buf.write(out)
out.close()
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org