In the end it would have been easier just to use Imagemagick for this. What a mess. Another example where a GUI seemed simple at first but then turned out to be a poor tool for the job.
I want to get this under version control now or it's going to wind up not happening again, like in previous years. More to come.