Did you ever use ImageMagic? It is a very powerful command line image processing program. I used it daily for 5-1/2 years.
On one occassion, I resized 40,000 images and thumbnails in one evening with it. Started it some time after 5:30 PM and when I came back to the office about 4:30-5:00 AM it was finished. It took original image sizes and shapes which varied and converted the size and dpi to a standard format for the web.
I maintained color and black and white images for print and different formatted version for the web.
It was absolutely amazing how efficient that was. And it was open source. My niece’s husband works for the Navy, was surprised to find that they use it too.
https://www.imagemagick.org/script/api.php
They have an awesome API. Allowed me to add image processing to my apps with no muss no fuss. I am intimately familiar with their stuff, and it is extremely well written. Tight compact efficient code. No OO BS I would assume. Almost like a master coder did it all in ASM.