I'm trying to crop a sequence of (8k) exr files and it seems like oiiotool
is quite a bit slower than using the python bindings and mulitprocessing.
Is this expected? I was under the assumption that it's always better/faster
to use oiiotool if possible. I've tried changing the --threads argument but
the results are the same. I'm on Windows.
oiiotool path/to/src.3935-3954%06d.exr --crop 6640x5760+1000+0
--runstats -o path/to/dst.3935-3954%06d.exr
--------------------------------
Time: 59 seconds
import sys
import os
import time
from multiprocessing.dummy import Pool as ThreadPool
import OpenImageIO as oiio
oiio.attribute("threads", 1)
def crop(path):
im = oiio.ImageBuf(path)
new_im = oiio.ImageBufAlgo.crop(im, oiio.ROI(1000, 7640, 0, 5760))
new_filepath = "{0}/{1}".format("D:/tmp/exr_crop", os.path.basename(path))
new_im.write(new_filepath)
dir_path = "D:/tmp/exr_src"
files = ["{0}/{1}".format(dir_path, x) for x in os.listdir(dir_path)]
st = time.time()
pool = ThreadPool(48)
results = pool.map(crop, files)
et = time.time()
print("Total time: {0}".format(et-st))
--------------------------------
Time: 6.9 seconds
/Simon
-------------------------------
Simon Björk
Compositor/TD
+46 (0)70-2859503
www.bjorkvisuals.com
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org