My question is pretty general, but I think I can express it clearly by giving two specific examples of things I can't figure out how to do using DOpus.
Resize image based on max(width,height)
I studied Leo's highly instructive posts about renaming scripts, so I see how to extract metadata like image width, image height, etc to use for various purposes, renaming and otherwise. Here are two of the relevant posts:
However, I can't figure out a way to resize a batch of images such that the dimensions are determined by the larger of width and height. The practical application is immensely practical, because now that Google Photos offers unlimited free online storage for images whose largest dimension is 2048 pixels, I want to take my entire image library and make a resized archive to upload to Google Photos. (Learning the API to do that efficiently is a whole nother can of worms I'll need to open eventually.)
The crux of my question is how I can access DOpus commands inside of a script. It seems like once you call a rename script, you're operating outside of DOpus.
Rotate based on a filename pattern
An even simpler task I can't figure out in DOpus is taking a batch of images and applying a rotate command if a given image satisfies certain properties, e.g. an indexical component of the filename is an odd number or even number. The practical application is taking a big folder of book scans where only the odd or even pages need to be rotated 180 degrees. I figured out an indirect solution, which is to write a rename script so that the odd and even numbers get renamed in some way that makes them really easy to select separately, like putting the words "odd" and "even" in the filename. But this example seems to illustrate the more general question about DOpus and I'm trying to gain a deeper understanding of the limitations of the program. I want to use some kind of if/then control logic in the DOpus commands before calling an external script. I'm just starting to learn how to write rename scripts, so if anyone has any advice or links for the odd vs even renaming case, I would be grateful!
Also, if it's not possible to do that stuff in DOpus, if anyone has advice about other approaches, I would be grateful. I'm going to try learning how to do command line batch processing with GIMP, so then I can use DOpus to select the files and run a batch file. As I'm a novice, I may be missing some basic techniques.
I don't think you need to use any complex scripting for this. If you tell Opus's Image-Convert command that you want the width & height to be 2048 but also want the aspect ratio preserved, then it will resize the images to fit into a 2048x2048 box, keeping the aspect ratio. I think that's what you want?
[li]Rotate based on a filename pattern
That, on the other hand, does requires scripting. Opus can do the rotations but you'll need some kind of script to work out which files you want to rotate and tell Opus to rotate only them.
You could use my "Abusing" Rename Scripts technique (as mentioned in your post) to make the script live inside an Opus button, but where the script lives is an afterthought compared to writing the script itself. It's usually easier to write a normal script (e.g. using VBScript and a .vbs file) to do what you want, and then when it's finished convert it into an Opus button if you want that as well.
I've never looked at GIMP's batch/script support so I don't know whether or not it would be a better choice. (I've done some Photoshop scripting and it could do it, FWIW.) Assuming scripting is possible, I'd say it makes sense to make the script work with whichever tool you are likely to be using when you want to perform the task. If I wanted to launch it from Opus, while managing files, I'd probably write some VBScript which took the filenames and selectively ran the Opus Image-Convert function on them. If I wanted to launch it from a tool like GIMP or Photoshop, while editing files, I'd look into scripting them.[/li][/ol]
For the resizing, yes, that's what I want! I didn't realize the command had that kind of "soft logic" built in. Great!
For the rotating and the general case, the part I don't understand is how to run an Opus command inside a script. I understand I can make *.dcf files that can be accessed by any other application, but I don't understand how I can control which files are acted upon when the file is run, other than whatever is selected via the Opus GUI.