Hi Tony,
See here:
https://openimageio.readthedocs.io/en/latest/pythonbindings.html#image-transformations-and-data-movement

So instead of
new_img = ImageBufAlgo.channels(img, channel_ids)

You need to add the newchannelnames. I think this should do it:
new_img = ImageBufAlgo.channels(img, channel_ids, ('R','G','B'))



On Wed, Feb 16, 2022 at 12:22 PM Tony DUGARD <tony.dug...@gmail.com> wrote:

> Hi,
>
> I'm currently writing a tool for splitting vray rendered exr into separate
> channels :
> For exemple, I have 6 channels :
> Channel 1 : "R"
> Channel 2 : "G"
> Channel 3 :  "B"
> Channel 4 : 'VRaySpecular.R'
> Channel 5 : "VRaySpecular.G"
> Channel 6 : "VRaySpecular.B"
>
> I've successful grouped the channel into a dict :
> channel_dict = {"" : (1, 2, 3), "VRaySpecular": (4, 5, 6)}
>
> With the following code :
> img = ImageBuf(path)
> for key, channel_ids in channel_dict.tems():
>     new_img = ImageBufAlgo.channels(img, channel_ids)
>     filename, filetype = os.path.splitext(path)
>     out_path = filename + "." + key + filetype
>     new_img.write(out_path)
>
> The problem i got is that the channel isn't shuffled into the new_img R,
> G, B channel but instead stay in the VRaySpecular.R, VRaySpecular.G,
> VRaySpecular.B
>
> I don't know how to shuffle the original channel to the RGB channel.
>
> Thanks.
> Tony
>
>
> _______________________________________________
> Oiio-dev mailing list
> Oiio-dev@lists.openimageio.org
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to