Photo AI from the command line

Running Windows 11 on CPU i9-13900KS 6GHz cores:8+16 Turbo Raptor Lake released Jan, 2023
GPU Nvidia RTX 3070 8GB
RAM 64GB DDR5 5200MHz
Mother Board ASUS ROG Maximus Z790 Hero

I can run PhotoAI from the Start menu OK. I can open up a cmd.exe terminal, cd to C:\program files\Topaz Labs LLC\Topaz Photo AI and enter Topaz Photo AI.exe someimage.jpg and it works.

What does not work is when I launch Photo AI from another program expecting to use the command line interface. Faststone is one such program but I also develop my own Java based image processing software and launch a variety of other software from inside that, including Topaz’s other packages. Everything works except for Photo AI.

I finally figured out what the problem is, Photo AI was shipped with debugging turned on which is only active when launched from another program. Photo AI starts spewing tons of messages out the error stream and won’t complete its start up until that has been cleared out. I put code in my Java program to get around this but that doesn’t help with Faststone and others.

Possible Topaz solutions:

  1. don’t ship a product with debug enabled
  2. provide a way to configure debug enable
  3. provide a command line flag to enable/disable debugging (e.g. -quiet)

General comment: Running the program from a command line should support a “–help” option to display a brief synopsis of command line options.

Hi!

Windows has some tricky caveats that make it hard to make a single executable work both as a GUI application and as a CLI. For this reason we have 2 executables inside the install directory.

You’re currently passing a file to the GUI, which makes it act like an external editor. If you want to use the program via the CLI, you’ll want to use the other executable, called tpai.exe. It has support for various command line options, including --help. It also will run completely headless, making it ideal for automation or use by purpose built tools.

In either case, logging is always enabled and will go to stdout and stderr as expected. The -quiet option is a good idea, and I’d suggest posting that to our #photo-ai:photo-ai-ideas forum.

1 Like

Thank you for the response.
I tried tpai.exe and it is not a workable solution for me, I need the interactive GUI to come up. I have a work-around for PhotoAI but I haven’t needed this for your other products. I did put in a suggestion for a -quiet flag as well as one to remember settings between runs.
P.S. I was wrong about Faststone, They apparently use the same work-around technique I do and Photo Ai works there just fine.

I’ve noticed that the latest Photo AI and perhaps prior releases runs faster the less images you give it. So if I give it 20 images and process it will probably use the GPU most of the time and go thru them quickly. If I load 19,000 images it will go a lot slower and it seems to run in some limbo state on each image where there isn’t really any system usage with occasional spikes on the GPU. is there a way to run command line and say I want to run it with Sharpening standard setting and in that settings to 80 and 1 plus subject only off. Then enable Recover faces with a value of 30? Then ask it to loop thru 154,000 images with those settings. Or is there just some generic settings I can apply. Didn’t look like the CLI went that granular.

Note I can handle batch looping, just figuring if I feed it one image at a time it will run super fast from what I can see. Just not sure I can pass these values directly.

At the moment we do not have a customizable CLI. We will be working on that in the near future so you can pick the specific CLI settings to use when processing your image.