HI Simon! Not certain, but you might be running into something I've experienced before regarding image cache size(?). However, I experienced the opposite where Python was slower than oiiotool due to different defaults. For the long explanation from Larry please search for the email with this subject: "Python - ImageBufAlgo.channels taking it's time (OIIO - 2.3.9.1)"
Have you tried upping your cache size (in MB) with the "--cache" flag? Docs: https://openimageio.readthedocs.io/en/v2.4.11.0/oiiotool.html#cmdoption-cache On Mon, May 8, 2023 at 11:41 AM Simon Björk <bjork.si...@gmail.com> wrote: > 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 > Oiio-dev@lists.openimageio.org > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > -- -Daniel
_______________________________________________ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org