DEV Community

TildAlice
TildAlice

Posted on • Originally published at tildalice.io

OpenCV vs Pillow: 10 Operations Benchmarked (2026)

Pillow Was 3x Slower on Resize — Then I Checked My Code

Last week I ran a benchmark comparing OpenCV and Pillow on 10 common image operations. OpenCV crushed Pillow on resize by 3.2x. Except it didn't — I was measuring Pillow in RGB mode while OpenCV ran in BGR, and my resize dimensions were wrong. After fixing the benchmark, the gap shrank to 1.4x for most operations, but the picture got more interesting.

This isn't another "OpenCV is faster" post. It's a breakdown of when each library wins, loses, and when it genuinely doesn't matter. I tested 10 operations on 1000 images (1920×1080 JPEGs), measured wall time and peak memory, and found results that contradicted several Stack Overflow answers I'd trusted for years.

Soft morning light illuminates a cozy train cabin bed in Lviv, Ukraine.

Photo by Anna Stepko on Pexels

The Test Setup: What I Actually Measured

Before diving into results, the setup matters more than people realize. I ran all tests on an M1 MacBook Pro with 16GB RAM, Python 3.11.9, OpenCV 4.9.0, and Pillow 10.3.0. Each operation was repeated 1000 times with different images to minimize cache effects.


python
import cv2

---

*Continue reading the full article on [TildAlice](https://tildalice.io/opencv-vs-pillow-10-operations-benchmark/)*
Enter fullscreen mode Exit fullscreen mode

Top comments (0)