Improvements to the command line interface (CLI)

Hello Team Topaz Labs,

10 months ago I asked for a CLI for PhotoAI, back then it was not available but planned, and now it exists, so thank you for that, this is awesome. Don’t know when it was added but I’m so happy it was.

I’m aware that this is only the beginning and that you will continue improving the CLI. So I thought why not giving some feedback about the things I noticed.

my system is macOS 11.7 and PhotoAI 1.5.0

Here is an overview of the topics

  • no online documention about the CLI
  • calling tpai without args
  • missing synopsis
  • no relative path supported
  • annoying log file message

No Online Documentation about the CLI

I found an online documentation about the VideoAI CLI but I couldn’t find any for PhotoAI CLI.

Calling tpai without args

it would be nice if calling tpai without args would be the same as calling it with --help

Missing Synopsis

Typically when printing a help text it is common to show how the tool shall be used.
E.g.
tpai [options] file [file2, ..., fileN]
and then list the options like you already do. As a reference you can look at any other unixoid commandline tool how they do it.

No relative path supported

When I ran
tpai --cli image.jpg
the error message says
[CLI] Invalid file or directory path:image.jpg
and after some attempts I figured out that the path as to be absolute.
So I changed my call to
tpai --cli ${PWD}/image.jpg
and then it worked.
So of course best and normal would be to support relative paths for input files and the output folder. Or at least as a quick solution the manual and help text should mention that absolute paths are mandatory.

Annoying Log File Message

Whenever I ran tpai it prints in the beginning

Checking if log directory should be pruned. Currently have 11 log files.
Number of logs exceeds max number to keep ( 10 ). Cleaning excess logs.
Logger initialized

Not sure if this is necessary to be printed on screen. Personally I don’t think so. Because what shall I do with that information? If you think it’s still useful then please print it only when --verbose is used. Also either showing the log file location or a possibility to delete the log files would be great.

That’s it for now :smiley:
I’m very happy that we got the CLI, so thanks again. Looking forward to more features and improvements.

Best regards,

marco

2 Likes

@marco.trosi I’m glad you’re happy with the CLI update!

We appreciate such a thorough response. I’ve documented your points for my team and we’ll definitely refer back to this post as we continue our discussions on how to improve the CLI.

1 Like

you are welcome @tim.he
thanks for reply, I appreciate it very much
have a great day
marco

1 Like

Hello, sadly the CLI is not actually usable at the moment.
Lets say you have a bunch of pictures that are cgi and a bit blurry and you want to process all of them with the same settings (enhance:cgi, sharpen:normal) you have no way of telling the CLI that. It will just auto-pilot through the given image or the given folder. You will get the same output as if you had been using the UI.

CLI was the main reason I originally bought Photo AI. I even programmed a Windows Service that would act as file watcher for specific inbox directories on a network share and trigger the Photo AI CLI. But sadly I soon found out that almost nothing can be specified. Not even models can be deactivated right now (so it’s like rolling the dice, as autopilot chooses different models for each image - even if it’s the same series of pictures I am processing).

I’ve written a summary here on the general batch issues.
And also one suggestion on the CLI here (Feel free to vote for it if it’s something you would also like).

Sadly CLI doesn’t seem to be a priority.

1 Like

Yes, we’re focused more on developing the GUI because that’s what the vast majority of our users use. We are, however, improving the Autopilot settings holistically which will improve the performance of the CLI as well.

I’ll go through your other posts and glean nuggets of wisdom to bring up to my team!

Hello @tim.he thanks for the info.

You said focus on UI, I can understand that. Can you tell me, why Photo AI wasn’t based on the proven UI of the old Gigapixel/… AI products? They supported vast batch processing and multi editing capabilities. There it was actually possible to do proper batch processing, apply selected aspects to a selection:
image

Photo AI only uses a simple “film strip”, which is OK when I open 2 or 3 images. But when loading many pictures (lets say hundreds or thousands) there is no way to properly work with that any more.
Every time you click an image in the film strip autopilot auto-kicks in and takes a long time moving controls of the UI back and forth before one can even click anything.

You added “Apply to All” as an option, but sadly even that is not usable in this scenario (as it copies everything, even the values detected specifically for the first opened image).

All of these functionalities were already there in the old Gigapixel/… AI products and they were easy to use, too. They offered a simple view but also an advanced table view (with multi editing).
Please don’t tell me it was just for marketing reasons so that the new product looks totally different. :wink:

I look forward to hearing from you.

1 Like

We’re working on the functionality now to apply select settings instead of all of them to the entire batch. This is expected to be released Sept 7 with v2.0 of Photo AI.

Your points about how the older apps has been noted. Why reinvent the wheel, right?

1 Like

Hello everyone,

I hope you’re all doing well. I’ve been closely following the discussions about the issues and enhancements related to the CLI of Topaz Photo AI and I’ve come across a specific issue that I’d like to share.

When I try to provide a file path to the CLI, I consistently get the error message “No valid image files passed” if the path contains one or more spaces. I’ve tried various methods to resolve this:

  1. Using escape characters for spaces: tpai --cli /Users/thomas/Desktop/Neuer\ Ordner\ mit\ Objekten/1.jpeg
  2. Enclosing the path in quotes: tpai --cli "/Users/thomas/Desktop/Neuer Ordner mit Objekten/1.jpeg"

Unfortunately, neither of these solutions has worked for me. I’m running this on MacOS.

Has anyone else experienced this? I’d appreciate any guidance or potential workarounds. Thank you for taking the time to read this and for your ongoing contributions to making this tool even better.

Best regards,
Alex

Hello @loewe1000

as you might have read from my initial message I was able to make it work with absolute path. Can you try to use a path without spaces. I know you are escaping them with backslash but that doesn’t mean that tpai is handling it correctly internally.
Let us know if it works with paths that don’t contain spaces or any other special characters.

–marco

sorry @loewe1000
now I read again your message, and I assume you already tried that and without spaces it works

then maybe try also this with single quotes

'path\ with\ space'
'path\\ with\\ space'

Thanks for your quick help.
Yes, without spaces it works as expected.

None of the following command work.
tpai ‘/Users/thomas/Desktop/Neuer Ordner mit Objekten/1.jpeg’
tpai ‘/Users/alexander/Desktop/Neuer\ Ordner\ mit\ Objekten/1.jpeg’
tpai ‘/Users/alexander/Desktop/Neuer\ Ordner\ mit\ Objekten/1.jpeg’