Mac Photo AI CLI only processing files with a number 1? Windows CLI doesn’t work at all?

I have been trying to find a way to batch process thousands of photos in Photo AI (or Sharpen, or…). I found a forum post documenting the --help of the command line, which I did not know about (I think the only CLI search on the help site is for Video AI).

I tried it several times from inside a folder containing 26,000+ images. It reports the correct number, then processes only about 454:

frames-full % /Applications/Topaz\ Photo\ AI.app/Contents/MacOS/Topaz\ Photo\ AI --cli *.jpg -o TEST   
Application settings: 
Overwrite Files: 0
Recurse Directories: 0
Input File Count: 26550
Output Folder: TEST
Output Format: Preserve
Jpeg quality: 95
Png compression level: 2
Tiff compression: none
Tiff bit depth: 16
ExifTool loaded!
. . .

The files it processes are all “frameX.jpg” in name, and it only does the ones starting with a 1:

frame1.jpg
frame10.jpg
frame100.jpg
frame1000.jpg
frame10000.jpg
frame10001.jpg
frame10002.jpg
frame10003.jpg
frame10004.jpg
frame10005.jpg
frame10006.jpg
frame10007.jpg
frame10008.jpg
frame10009.jpg
frame1001.jpg
. . .

Since it reports 26550 input files, I expect the wildcard is working.

Tips appreciated.

In the meantime, my workaround is to do the photos in groups using wildcards like:

frame?.jpg – all one digit files (1-9)
frame??.jpg – all two digit files (00-99)
frame 1??.jpg – all the 1xx files

This will take me days, so I am hoping I can just do ???.jpg and maybe 1???.jpg (if it can handle 10,000 files without messing up.) I’m slowly testing to see what the limit is.

Now I check the Windows version, and the CLI there doesn’t seem to work with wildcards at all. If I give it one file.jpg to process, it will create the “-o TEST” output directory but nothing goes in it. When I use wildcards it returns instantly. If I get if one specific name, it pretends its doing something but returns shortly after with no processed file generated.

Oh, if only it was this fast!

ChatGPT generated batch file:

@echo off
setlocal enabledelayedexpansion

:: Set the command and output directory as hardcoded variables
set command="%ProgramFiles%\Topaz Labs LLC\Topaz Photo AI\Topaz Photo AI.exe"
set output_dir=OUTPUT

for /f "delims=" %%a in ('dir /b /a-d "frame*.jpg"') do (
    set filename=%%a
    if not exist !output_dir!\!filename! (
        echo Processing !filename!
        !command! --cli "!filename!" -o !output_dir! -overwrite
    ) else (
        echo Skipping !filename!
    )
)

echo All done!
endlocal

ChatGPT generated macOS shell script:

#!/bin/bash

# Set the command and output directory as hardcoded variables
command="/Applications/Topaz Photo AI.app/Contents/MacOS/Topaz Photo AI"
output_dir=OUTPUT

for file in frame*.jpg; do
    # Check if a file with the same name exists in the output directory
    if [ ! -f "$output_dir/$file" ]; then
        echo "Processing $file"
        "$command" --cli "$file" -o "$output_dir" -overwrite
    else
        echo "Skipping $file"
    fi
done

echo "All done!"

Well, that’s useful :slight_smile:

Thanks @allenhuffman, I just ran into the windows issue myself and thought I was doing something wrong since the documentation for this is non existent.

I can confirm that no file is created in the output folder. When using the --showSettings it does seem the image is processed correctly.

I don’t have a mac so I can’t confirm that but it does sound that your batch file would be a workaround for that issue. Unfortunately I cant try that and have to wait until the windows issue gets fixed.

I can load a max of 1000 images in Photo AI, when loading more my system gets less and less responsive. But I feel that even with 1000 images the processing is slower per image then say 10 images. So I am looking forward to use the CLI.

I have been processing images, one at a time, on the M2 Mac using that batch file – for days :slight_smile: It’s slower since it has to relaunch the program each time. But, trying to open even 700 photos and export doesn’t always produce 700 photos. I’m not sure if I’ve ever had it do them all. On the Windows 11 Alienware machine, I’ve had similar issues when opening lots of photos.

Wow, thanks!! I find tools like Jasper and chatgpt super useful for a lot of my work.