Looking over this original email again, I think I can spot some problems even without the test images.
> On Oct 2, 2021, at 2:56 AM, jan <kakam...@gmx.com> wrote: > > Hello i’m trying to composite an alpha onto a rgb image from a different file. > > fillholes_pushpull seems to work as expected on 8bit images but on float > images the values go over the roof. > Also I think i’m composing a correct rgba imagebuf but the output is always > black that way. > So I don’t know what’s wrong. Here’s the code: > I can send you the test images if needed. > Thank you. > > import OpenImageIO as oiio > from OpenImageIO import ImageInput, ImageOutput > from OpenImageIO import ImageBuf, ImageSpec, ImageBufAlgo > > fg = oiio.ImageBuf(‘/name.Diffuse.exr’) # exr or jpeg same problem > bg = oiio.ImageBuf(‘/name.Opacity.exr’) OK, so at this point, you have read two images. What are the channels in them? How are they named? Are the channels in Diffuse.exr named "R", "G", and "B"? What about Opacity.exr? Is that a single channel named "A"? Or is it an RGB image, or what? > al = oiio.ImageBufAlgo.channels (bg, (0, )) OK, now this line has extracted just the first channel of the background. Here I am making a guess: might it be the case that Opacity.exr was an RGB image, with channels named "R", "G", "B"? If that is the case, then now image "al" is a single channel image whose channel is named "R". > al = ImageBufAlgo.contrast_remap (al, black=0.4, white=0.6) > > temp = oiio.ImageBufAlgo.channel_append (fg, al) Now temp is a 4(?) channel image that has the original channels of "fg" (which I'm assuming are named "R", "G", "B"), and also the extracted channel from bg, which is named... "R"? Something else? I suspect that this is the problem. Now you have an image temp whose channels are "R", "G", "B", and "something that is probably not A", and also you've given no indication that this channel should be interpreted as alpha... > outbuf = oiio.ImageBufAlgo.fillholes_pushpull(temp) ... so of course fillholes_pushpull complains that there is no alpha channel, because it has no idea that there is an alpha channel. I think the easiest way to fix this is to rename the channels to defaults right before you call fillholes_pushpull, which will make it clear which is alpha. temp.specmod().default_channel_names() outbuf = oiio.ImageBufAlgo.fillholes_pushpull(temp) I *think* that should work? -- Larry Gritz l...@larrygritz.com
_______________________________________________ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org