I’m generating a few thousand RGBA frames as NumPy arrays (shape=(H, W, 4), dtype=uint8) and need to dump them all as lossless WebP as fast as possible. Right now I’m using: import webp import numpy as np def save_frame(path: str, img: np.ndarray): # img is HxWx4,uint8 webp.imwrite(path, img, lossless=True) It works, but writing ~15 K images still takes quite a while. I’ve looked at cv2.imencode and imwrite, but they were slower than webp.imwrite. What’s the best approach (in-process or via a C library) for maximum throughput? My code is already completely parallel and runs on any CPU core. The question is rather how to maximize the per-process throughput. Thanks for all suggestions in advance! Continue reading...