GMIC commandline output quality parameter problem

I am using gmic command line to do some batch processing. Input and output folders have spaces in the name, so I have to use double quotes inline with gmic. Now the problem arise when I try to set output quality parameter along with double quotes.

Working (85% output quality):
gmic <some command> output c:\test.jpg,85
Working (100% output quality):
gmic <some command> output "c:\te st.jpg"

Problem:
gmic <some command> output "c:\te st.jpg",85

I don’t know what shell you are using on Windows, so maybe my solution won’t work for you, but using bash on Linux, I would write something as:

gmic <some command> output \"c:\te st.jpg\",85

Haven’t tested with the c:\, but maybe worth trying :slight_smile:

1 Like

Bonjour,

gmic 256,256,1,4 chessboard 32,32,0,0,0,1,0,0,0,255,255,255,255,255 File="c:\toto\te st.jpg" o $File,85

:o)

I am calling it through subprocess in python. I tried cmd and powershell under windows 10, but no luck.
subprocess.run(cmd)

with powershell:
gmic '.\data_28_10\to pc.on_1\edge_mask.png' output \'edge mask1.png\',80

output:
[gmic]-1./ Output image [0] as png,80 file '\edge mask1.png,80' (1 image 8000x4000x1x4).Invalid Parameter - 100
'gm.exe' is not recognized as an internal or external command,
operable program or batch file.

@samj I face same error even using variables :confused:

Bonjour,

This is not a G’MIC problem.
Review your scripts in Python and Powershell.
If you have any problems you can try my command line from the terminal or have your Python scripts modified.
You can also create scripts in .bat files (it’s simple and very efficient).

:o)

1 Like

Ok, got the solution. Just need to replace <space> with \<space> like this:

gmic infile.jpg output my\ file.jpg,85

thanks @samj and @David_Tschumperle

1 Like