Must it be oiiotool?

I think a very short Python script might be a lot more efficient. It would 
perhaps look like this: 


# Make an ImageBuf for your template file and read the spec. 
# Note: this will avoid reading the pixels until needed, only opens
# the file and reads enough to get the spec, should be cheap!
b = ImageBuf("template.exr")
templatespec = b.nativespec()

# Make a new image with the same spec -- should initialize to black pixels
newbuf = ImageBuf(templatespec)

# Write it
newbuf.write("out.exr")


Caveats:
1. I'm typing this off the top of my head, not testing it, but you'll get the 
idea.
2. I make no promises about OIIO 1.7. Please try 2.0 or master if at all 
possible. A lot about
the python bindings has changed and improved since 1.7.



> On Jul 25, 2019, at 11:55 AM, Will Anielewicz <[email protected]> 
> wrote:
> 
> Yeah I figured you would suggest that ... I do want to keep all the metadata 
> and channel names.
> 
> 
> On Thu, Jul 25, 2019 at 11:17 AM Larry Gritz <[email protected] 
> <mailto:[email protected]>> wrote:
> Is there a reason you're reading a file to make a black image? Is that just a 
> way of setting up the right resolution and channel names and metadata?
> 
> The stats are probably a little misleading. When inputting a big image (4k x 
> 27 chans!) it will be backed by ImageCache and tiles read on demand, so all 
> the input costs are actually showing up in the --ch (it's reading bits as it 
> needs it).
> 
> I think it should be fast to just create a new image from scratch:
> 
>     oiiotool -create 4096x2000 37 -chnames R,G,B,A,alice,bob,charlie -d half 
> -o black.exr
> 
> 
> 
>> On Jul 25, 2019, at 9:06 AM, Will Anielewicz <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Im using a bit older a version  1.7.17.
>> Im trying to find the quickest way to set the RGBA default channels of a 37 
>> channel 4k openexr file to a 0.0 value. Im doing this to replace missing/bad 
>> frames in a sequence. On my fairly hefty workstation its taking 48 seconds. 
>> I could just do this once per sequence and duplicate for every other 
>> missing/bad frame but ...  Im trying to keep everything else in the file 
>> intact like resolution and metadata etc
>> At first I tried this ... which understandably takes 48 seconds.
>> 
>> oiiotool -i frame.exr  --mulc 0.0 -o foo.exr
>> 
>> after reading the programmer document with it's excellent examples I did 
>> this:
>> 
>> oiiotool -threads 0 --autitile 1 --threads 0 --autotile 1 -i:ch=R,G,B,A 
>> frame.exr  --ch R=0,G=0,B=0,A=1 --compression "zip" -o foo.exr
>> 
>> still took 21 seconds ... ...
>> 
>> Threads: 32
>> oiiotool runtime statistics:
>>   Total time: 21.29s
>>       --ch         : 21.13
>>       -o           :  0.14
>>       input        :  0.01
>>       unaccounted  :  0.00
>>   Peak memory:    2.0 GB
>>   Current memory: 2.0 GB
>> 
>> 
>> 
>> _______________________________________________
>> Oiio-dev mailing list
>> [email protected] <mailto:[email protected]>
>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
>> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
> 
> --
> Larry Gritz
> [email protected] <mailto:[email protected]>
> 
> 
> 
> 
> _______________________________________________
> Oiio-dev mailing list
> [email protected] <mailto:[email protected]>
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]




_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to