[PTAI CLI] - Photo AI CLI - allow arguments to influence settings

Hello,
I just bought the Photo AI package because it has initial CLI functionality - which is a good starting point.

I’m currently programming a Windows Service for my local workstation, that recursively monitors input directories and upon detecting supported files starts up the Photo AI CLI to process those images storing them in defined output directories.

I was thinking of having a few input directories like
inbox\enhanceCgi_sharpenStd
inbox\enhanceHq
And having the windows service pass along options to the CLI accordingly.

I usually have very specific types of images - where I already know that filters to use.
For example lots of CGI generated images. Or images that need std-sharpening.

But my problem is, that there is currently no way for me to influence how images are processed via CLI in terms of which models are applied and to what factor. And I also can’t use Gigapixel AI, Sharpen AI, etc. directly as they provide no CLI at all (at least to my current knowledge).

I assumed, that at least setting the autopilot default options in the Photo AI GUI (that are stored in the Win Registry) would have some influence over what the CLI chooses, but it doesn’t seem to matter what is set there, e.g. I have face detection: none, scale: fixed 4x. But when using the CLI it does its own thing scaling it only to 2x…

  1. What I propose is some way to set the desired settings also in CLI (so that each CLI call can have different settings).
    We’re mainly talking about the major features via argument
    -denoise=off/normal/strong
    -sharpen=off/std/strong
    -recoverFaces=off/on
    -enhance=std/hq/gfx/lowres (this is important for me)
    -upscale=1x/2x/4x/max (this is important for me)
    -crop=x,y
    Or someting along those lines.
    The auto settings inside the models usually work quite well; once the correct model for the images is selected.

  2. There is another/alternative idea: You already provide the option of viewing most settings via --showSettings
    Autopilot Settings for c:\PhotoAI\2.jpg

{
    "Denoise": {
        "auto": true,
        "enabled": false,
        "model": "Low Light",
        "param1": 0,
        "param2": 0
    },
    "Enhance": {
        "enabled": true,
        "model": "High Fidelity",
        "param1": null,
        "param2": null,
        "param3": null
    },
    "Face Recovery": {
        "auto": true,
        "enabled": false,
        "param1": 0.800000011920929,
        "selectedFaces": null
    },
    "Sharpen": {
        "auto": true,
        "compression": 0,
        "enabled": false,
        "lensblur": 0,
        "mask": false,
        "model": "Sharpen Motionblur",
        "motionblur": 0,
        "noise": 0,
        "param1": null,
        "param2": null
    }
}

As far as I can tell, only the upscale setting is missing there.

In the GUI you have an option “Apply current settings to all images”.
If there was an additional option “Save current setting to file” in the GUI and the CLI had an argument allowing for --useSettings c:\mySettings.json that would be ideal. Plus an argument allowing to also influence the upscale factor (in case that is not part of the json already).
The methods for applying existing settings are already there in Photo AI (via GUI), therefore it should be easy to adapt that to the CLI.

I really hope that something along these lines is possible to implement.
As Photo AI is a really great product. And the CLI is encouraging one to use it and to write programs and or scripts wrapped around it.
But the limitations of not being able to manually set options for the desired jobs is a killer (at least from my point of view).
It’s no fun processing 10.000 images via GUI…

Thanks a lot in advance and keep up the good work!

I would much prefer to have the options adjustable within the command line. I need to change the options for every iteration, especially the scale factor.

Thanks!

CLI Enhance enabled is upscaling with 4x for me in it acquires it from the GUI preferences>set output size=4, so not sure why you are not seeing it with regedit. Maybe you have GUI preferences set to scale only small rather than all images? Note that CLI upscaling last worked in 1.3.2 it broke in 1.3.3 and claimed fixed in 1.3.4.

Also denoise is badly needed as this is not even a GUI auto setting so there is no way to control it other than manual GUI per image, which is painful because auto enhance parameters when denoise is set would be wrong if you turn off denoise.

The existing --show settings would work fine for an import .json setting, but for CLI you also want -switch argument equivalents. Both ways would need to have the ability for auto to derive the parameters per image, or to manually set the parameters just like with the GUI.

Often I have a bunch of images, where I know exactly what kind of images they are. For example computer generated graphics. And currently there is no way to set the enhance model to graphics in the CLI (it auto-detects every picture, mostly wrong as High Fidelity), which makes it completely unusable. If there was at least a GUI preferences for such things, that would help a bit (one could save/restore the registry before a CLI job).
But direct command line switches for these aspects would of course be way better…

@tim.he You wrote to me on May 22nd:

Currently, only Autopilot is enabled when using the CLI. We’re working on adding customizability to it for a future release coming soon.

Is there any update on that (roadmap/upcoming version)?
Thanks a lot!

1 Like

Also very interested in this. Didn’t know to click Vote until now. I would like to update the target resolution from the CLI, etc.

Is there any news on this?

The added autopilot preferences in 2.0.1 (which are actually stored in the registry) help, I’m using them (with single .reg files) before starting a CLI batch as a workaround. :slight_smile:
But sadly there is still no way for me to directly input all values/parameters, like it is possible in the UI.

I need some way to specify the values directly. Either by CLI command line switch, or by an optional autopilot preference (2.0.0 only introduced some kind of value weighing, which doesn’t do a lot for me).

1 Like

At the moment, there is still no way to input them directly as they only run based on the Autopilot preferences. Unfortunately the CLI is deprioritized in comparison to the GUI since the vast majority of our users use the GUI. Thanks for understanding!

I wonder if a lot more users would use the CLI if these/more features were added. And more customers would buy? :wink: what is the code stack, any way for public to try to add? Curious

2 Likes

What chauey is saying has merrit. Many of the users in this forum that have tried using the CLI or batch features were not happy and a lot of them even said that they would not even renew their subscription.

Plus: I think that a working CLI that covers most of the settings the UI has would bring you a long way towards the ability to integration test the entire Application.
And it shouldn’t be too hard to just feed values via json (instead of the autopilot method output).

I’m proposing a simple:

  • command line parameter to read a json file, e.g. --useSettings myFile.json
  • AutoPilot is still run for each image and stored in the variable that you already use in memory
  • But then every (sub)property that is specified in the loaded json (e.g. Enhance/enabled, Enhance/model, …) overrides the one of the autopilot. So in the end you have a merge between AutoPilot and the json. [And if everything was specified in the JSON file, it uses all settings from that file / If only Enhance/model=High Fidelity was specified it uses all AutoPilot settings, except the specific enhance model HQ]

The JSON file could come from this idea, saved via UI.

That should be pretty simple to implement. And it would allow users to re-calculate existing images (or sets of images) with a given preset of their choice. They could even re-run the image in different [future] versions, with the same values to see if the results improved.

And in your integration tests you could trigger the models with specific values and then get an exact expected result image (with which you can compare).

1 Like

Fair point.

I’ll forward this suggestions to our developers and let them know that people are increasingly interested in using the CLI.

2 Likes

What is the status on this?

They implemented something in this area which is usable, see: Problem with overwrite filter settings via the CLI

The bugs in that post have been fixed, one can now either use explicit settings only. Or use autodetected values and only override specific ones.