Signynt / signynts-darkroom-shortcut

A one-click workflow for film negative inversion with dust or scratch removal
MIT License
35 stars 4 forks source link

convert: command not found #1

Closed pabloheimplatz closed 2 years ago

pabloheimplatz commented 2 years ago

First off all thank you very much for this workflows!

Maybe I'm to tired but I can't figure out what is wrong. After I installed everything I got the following error message:

The action “Run Shell Script” encountered an error: “/usr/local/bin/negfix8: line 132: convert: command not found
/usr/local/bin/negfix8: line 141: convert: command not found
/usr/local/bin/autolevel: line 221: convert: command not found

autolevel:

USAGE: autolevel [-c colormode] [-m midrange] infile outfile
USAGE: autolevel [-h or -help]

OPTIONS:

-c      colormode       colorspace/channel to use to compute 
min, max, gamma statistics; choices are: 
gray, intensity, luminance, lightness, brightness, 
average, magnitude, rgb; default=luminance
-m      midrange        midrange value for autogamma part of script;
0<float<1; default=0.5

/usr/local/bin/autocolor: line 275: convert: command not found

autocolor:

USAGE: autocolor [-m method] [-c clipmode] [-l cliplow] [-h cliphigh] [-n neutralgray] infile outfile
USAGE: autocolor [-help]

OPTIONS:

-m      method            method to adjust neutral color; method=gamma, 
recolor, none; default=recolor
-c      clipmode          clip channels mode; clip=together or separate; 
default=separate
-l      cliplow           clip percent on low end of histogram; 
float; 0<=cliplow<=100; default=0.1
-h      cliphigh          clip percent on high end of histogram;
float; 0<=cliphigh<=100; default=same as cliplow
-n      neutralgray       neutral gray value (percent); float between 
0 and 100; default=mean of luminance

rm: /Users/pablo/Downloads/Example-negfix8.tif: No such file or directory
rm: /Users/pablo/Downloads/Example-autolevel.tif: No such file or directory”

Firstly I thought it could be a M1 problem with the scripts. But autolevel and autocolor for example are working if I start them from the terminal on an example. Also the convert command is working in my terminal. Maybe I'll found tomorrow a solution. I'll update my Issue here. :)

Signynt commented 2 years ago

Hmm, that's a weird issue. What version of imagemagick do you have installed? It shouldn't be an M1 issue, I made the script on a Mac Mini M1.

Can you also run negfix8 on a test file as well?

pabloheimplatz commented 2 years ago

negfix8 is also running. imagemagick is in version 7.1.0-18 installed via brew.

Thanks for the M1 info. I'll also debug it further this afternoon. Maybe it's some access errors on my Download folder or something like this.

Signynt commented 2 years ago

Just to make sure: is it the Q16-HDRI version of Imagemagick? It's very weird, because it seems like the individual components work fine...

Try running the shell commands from the workflow manually, and see if you get an error with them:

export PATH="/usr/local/bin:$PATH"

for f in "$@"
do
    cd "$(dirname "$f")"
    negfix8 -cs $f "${f%.tif}-negfix8.tif"
    autolevel "${f%.tif}-negfix8.tif" "${f%.tif}-autolevel.tif"
    autocolor "${f%.tif}-autolevel.tif" "${f%.tif}-InvertedSimple.tif"
    magick -quiet $f -delete 0 -normalize "${f%.tif}-ir.tif"
    magick -quiet $f -channel 0 -separate -normalize "${f%.tif}-red.tif"
    magick -quiet "${f%.tif}-ir.tif" "${f%.tif}-red.tif" -fx 'u/v' -threshold 1% "${f%.tif}-Dust.tif"
    magick "${f%.tif}-InvertedSimple.tif" "${f%.tif}-Dust.tif" -channel-fx '|gray=>alpha' "${f%.tif}-Inverted.tif"
    rm "${f%.tif}-negfix8.tif"
    rm "${f%.tif}-autolevel.tif"
    rm "${f%.tif}-ir.tif"
    rm "${f%.tif}-red.tif"
    rm "${f%.tif}-InvertedSimple.tif"
    rm "${f%.tif}-Dust.tif"
done

You'll need to edit the commands to replace the variables with the file names. Perhaps the issue has to do with the permissions of Automator? Check what permissions it has in the Privacy section of System Preferences.

pabloheimplatz commented 2 years ago

Weird. All steps are working perfectly if I set $f to Example.tif. convert -version returns also the current and correct version.

Must be something with the permissions... I can't find anything. Even after add the Automator to "Full Disk Access" nothing changed...

pabloheimplatz commented 2 years ago

Even the "Convert to tiff" workflow is working perfect. So it can't be anything with the access permissions...

pabloheimplatz commented 2 years ago

Got it! I changed the first line in your script.

Previously it was export PATH="/usr/local/bin:$PATH" I changed it to source ~/.zshrc

I'm unsure why I needed this on my system, because in my zsh config I also exported the $PATH to /usr/local/bin. But now everything is working.

For everyone else, you can edit the workflow by right click it and say "open with automator" -> edit -> safe -> double click on it -> run in from finder in your file. ✅

Signynt commented 2 years ago

Can you do me a favor and see if the workflow works for you if it starts like this?

source ~/.zshrc
export PATH="/usr/local/bin:$PATH"

So that it includes both source and export at the beginning. Another user hasn't been able to get it to work without using source, but on my system it doesn't work without using export, so I'm trying to include both, on my systems the above combination works, but I want to make sure it also works for people who's systems requires source to be included.

Thanks!

pabloheimplatz commented 2 years ago

works (also directly from your new release). Thank you!