I wrote a script that uses Wand/ImageMagick to assign an ICC profile to images. I parallelized it by using a ThreadPoolExecutor from Python's concurrent.futures module:
with ThreadPoolExecutor(max_workers=10) as ex:
ex.map(iccme.apply_icc_to_image, (Path(x) for x in args.images))
The relevant Wand usage is:
def apply_icc_to_image(self, image_path : Path) -> None:
print(f" Processing {image_path}...")
with Image(filename=image_path) as image:
image.profiles["icc"] = self.icc_data
image.save(filename=image_path)
This script works perfectly on Ubuntu 24.04 and 22.04, yet when I try to run it on MacOS, it always seg faults. Here's the top of the error report:
I can work around this in the meantime by switching to a ProcessPoolExecutor which works flawlessly on MacOS as well, but I would like to go back to using threads since the task is mostly I/O-bound and not CPU-bound.
I wrote a script that uses Wand/ImageMagick to assign an ICC profile to images. I parallelized it by using a ThreadPoolExecutor from Python's
concurrent.futures
module:The relevant Wand usage is:
This script works perfectly on Ubuntu 24.04 and 22.04, yet when I try to run it on MacOS, it always seg faults. Here's the top of the error report:
Here's the full report: error.txt
I can work around this in the meantime by switching to a ProcessPoolExecutor which works flawlessly on MacOS as well, but I would like to go back to using threads since the task is mostly I/O-bound and not CPU-bound.