Ick. The problem is that ImageBuf only holds one subimage at a time. And, er, 
it's a little tricky to write a multi-subimage file with IB's from Python. 
That... needs fixing, it's a bit embarrassing that I don't have a simple 
answer. I guess it's rare enough that nobody has complained, so I didn't quite 
realize how tricky this particular task would be.

MUST this be Python, or can you use oiiotool for this task? (It's got the 
multi-subimage workflow down.)

To test this, I tried:

# Make 5 images
oiiotool --frames 1-5 --pattern "checker:color2={FRAME_NUMBER/8}" 1024x1024 3 
-d half -o "{FRAME_NUMBER}.exr"
# Staple them together as subimages
oiiotool [1-5].exr --siappendall -o all.exr
# Add text, the -a is crucial to preserve and operate on all subimages
oiiotool -a all.exr --text:x=100:y=100 HELLO -o text.exr

and the resulting text.exr does seem to have the text in all subimages.

Now, I did this with master, and also verified with the current supported 
release, 2.1.

Maybe it will work with older, too, but I haven't checked. Release 1.8 is very 
old, I wouldn't want to try to figure out what was wrong if it didn't work the 
first time. So many things have been fixed and improved since then.



> On Apr 24, 2020, at 8:34 PM, Jake Richards <tru...@blueskystudios.com> wrote:
> 
> Hello:
>   I apologize if this isn't the forum for asking a question like this, but I 
> was attempting to render some text into the first sub image of an exr but it 
> appears the ImageBuf will only write out the current sub image.  My simple 
> code is:
> 
> import OpenImageIO as oiio
> ib=oiio.ImageBuf("L.0101.exr")
> oiio.ImageBufAlgo.render_text(ib,100,100,"HELLO",60,"Arial Bold",(1,1,1,1))
> ib.write("hello.exr")
> 
> The original exr has 16 sub images but hello.exr has only the 1.  What would 
> be the best way to get all sub images written out with rendered text?  Would 
> I have to iterate all the sub images copying their spec/pixels?  We are using 
> an older version of oiio, 1.8.7 but I might be able to convince them to 
> upgrade if this is easier in the master release.  Thank you!
> 
> Jake
> 
> _______________________________________________
> Oiio-dev mailing list
> Oiio-dev@lists.openimageio.org
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
l...@larrygritz.com




_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to