Resizing
Making an image larger or smaller. The lesson is Resize.
Half size and double size, with linear, cubic and box filters. Speed is the best of 7 runs; memory is the extra peak RSS of one isolated process per measurement.
resize, half size, linear (triangle)
libstb, Pillow and scikit-image prefilter when shrinking; OpenCV's INTER_LINEAR and INTER_CUBIC do not (faster, and they alias), and INTER_AREA is its antialiasing counterpart. "libstb" is Resizer(filter, srgb=False), the like-for-like pairing; "libstb (sRGB-correct)" is the library's own default, which blends in linear light like a correct resizer should, listed separately so the price of that is visible. 3-channel images only. scikit-image is skipped above 1 MP (seconds per call).
OpenCV is the reference (fastest on the most corpus entries). On average (, the mean of each entry's own ratio, not a ratio of medians): libstb 2.8×, libstb (sRGB-correct) 6.7×, Pillow 10.6×, scikit-image 155.3× as long.
OpenCV needs the least extra memory on the most entries (extra peak RSS on top of what the process held before the operation started; images under 0.065 MP are not measured).
Throughput vs. image size (higher is better)
Time vs. image size (lower is better)
Extra peak memory vs. image size (lower is better)
resize, half size, cubic (Catmull-Rom)
libstb, Pillow and scikit-image prefilter when shrinking; OpenCV's INTER_LINEAR and INTER_CUBIC do not (faster, and they alias), and INTER_AREA is its antialiasing counterpart. "libstb" is Resizer(filter, srgb=False), the like-for-like pairing; "libstb (sRGB-correct)" is the library's own default, which blends in linear light like a correct resizer should, listed separately so the price of that is visible. 3-channel images only. scikit-image is skipped above 1 MP (seconds per call).
OpenCV is the reference (fastest on the most corpus entries). On average (, the mean of each entry's own ratio, not a ratio of medians): libstb 1.8×, libstb (sRGB-correct) 3.6×, Pillow 7.9×, scikit-image 352.1× as long.
OpenCV needs the least extra memory on the most entries (extra peak RSS on top of what the process held before the operation started; images under 0.065 MP are not measured).
Throughput vs. image size (higher is better)
Time vs. image size (lower is better)
Extra peak memory vs. image size (lower is better)
resize, half size, box / area
libstb, Pillow and scikit-image prefilter when shrinking; OpenCV's INTER_LINEAR and INTER_CUBIC do not (faster, and they alias), and INTER_AREA is its antialiasing counterpart. "libstb" is Resizer(filter, srgb=False), the like-for-like pairing; "libstb (sRGB-correct)" is the library's own default, which blends in linear light like a correct resizer should, listed separately so the price of that is visible. 3-channel images only. scikit-image is skipped above 1 MP (seconds per call). scikit-image has no box filter.
OpenCV is the reference (fastest on the most corpus entries). On average (, the mean of each entry's own ratio, not a ratio of medians): libstb 2.0×, libstb (sRGB-correct) 5.9×, Pillow 7.0× as long.
OpenCV needs the least extra memory on the most entries (extra peak RSS on top of what the process held before the operation started; images under 0.065 MP are not measured).
Throughput vs. image size (higher is better)
Time vs. image size (lower is better)
Extra peak memory vs. image size (lower is better)
resize, double size, linear (triangle)
libstb, Pillow and scikit-image prefilter when shrinking; OpenCV's INTER_LINEAR and INTER_CUBIC do not (faster, and they alias), and INTER_AREA is its antialiasing counterpart. "libstb" is Resizer(filter, srgb=False), the like-for-like pairing; "libstb (sRGB-correct)" is the library's own default, which blends in linear light like a correct resizer should, listed separately so the price of that is visible. 3-channel images only. scikit-image is skipped above 1 MP (seconds per call).
OpenCV is the reference (fastest on the most corpus entries). On average (, the mean of each entry's own ratio, not a ratio of medians): libstb 1.5×, libstb (sRGB-correct) 3.4×, Pillow 5.5×, scikit-image 130.8× as long.
OpenCV needs the least extra memory on the most entries (extra peak RSS on top of what the process held before the operation started; images under 0.065 MP are not measured). On average, : libstb (sRGB-correct) 0.9×, libstb 0.9×, Pillow 2.6×, scikit-image 18.3× as much.
Throughput vs. image size (higher is better)
Time vs. image size (lower is better)
Extra peak memory vs. image size (lower is better)
resize, double size, cubic (Catmull-Rom)
libstb, Pillow and scikit-image prefilter when shrinking; OpenCV's INTER_LINEAR and INTER_CUBIC do not (faster, and they alias), and INTER_AREA is its antialiasing counterpart. "libstb" is Resizer(filter, srgb=False), the like-for-like pairing; "libstb (sRGB-correct)" is the library's own default, which blends in linear light like a correct resizer should, listed separately so the price of that is visible. 3-channel images only. scikit-image is skipped above 1 MP (seconds per call).
OpenCV is the reference (fastest on the most corpus entries). On average (, the mean of each entry's own ratio, not a ratio of medians): libstb 2.1×, libstb (sRGB-correct) 3.9×, Pillow 8.0×, scikit-image 872.2× as long.
OpenCV needs the least extra memory on the most entries (extra peak RSS on top of what the process held before the operation started; images under 0.065 MP are not measured). On average, : libstb (sRGB-correct) 0.6×, libstb 0.6×, Pillow 1.8×, scikit-image 118.1× as much.