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.


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.