In case anyone's planning to thumbnail some PNGs and JPEGs in Python, whether you use PyQt, PyOpenCV, or write your own little wrapper around Rust's image crate using PyO3 or rust-cpython, I recommend not using Pillow.

On my test corpus with a warmed cache, the others consistently took about 2/3rds the time Pillow did... though PyOpenCV was a hair slower than the others at ~25 seconds rather than ~23. (Pillow was ~33.)

@ssokolow Huh and I always though that it's particularly easy to use some shell script and ImageMagick...

@phel It's for populating the XDG shared thumbnail cache for a PyQt-based GUI I'm writing. The only reason I explored alternatives to doing it in PyQt is that I have prior experience flipping grids of pixels back and forth between PyQt and PyOpenCV and wanted to optimize for performance.

@phel Funny enough, my first "bare minimum of Geeqie's collection view, but in PyQt" tester loaded already-generated thumbnails off disk twice as fast as Geeqie... which either speaks well of Qt or poorly of whatever Geeqie's doing with GTK.

@ssokolow In this case, one way to go about it is to use the systems provided thumbnailer via dbus... should not be much more than a few calls...

@phel Three problems with that. First, Kubuntu Linux 20.04 LTS doesn't provide an org.freedesktop.thumbnails.Thumbnailer1 implementation. Second, I like to keep my options open for py2exe-ing Windows builds... which means no dependencies on external system services. Third, that'd just slow things down even if I *weren't* planning to calculate some hashes while I have the image loaded into memory anyway.

QOTO: Question Others to Teach Ourselves