How to setup nconvert for use on MacOS Catalina [Solved]

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

mgegersdorfer
Posts: 9
Joined: Sat Apr 29, 2023 7:52 am

How to setup nconvert for use on MacOS Catalina [Solved]

Post by mgegersdorfer »

I've been at it for a week now. I can't figure it out. what am I doing wrong?

I tried the below before & after adding environment variable.
environment methods used were from the following links. used "env" after restarting Terminal to confirm. All methods worked for me.
https://support.apple.com/en-au/guide/t ... 006f8f/mac
https://stackoverflow.com/questions/655 ... s-catalina
https://apple.stackexchange.com/questio ... s-catalina
set my environment variables as follows;
echo 'export nconvert=/Users/matthew/NConvert/nconvert' >> ~/.zshev
echo 'export nconvert=/Users/matthew/NConvert/' >> ~/.zshev

I've tried the following.
  • nconvert -wmopacity 7 -wmflag center -wmsize 98 -wmfile "/Users/uName/Desktop/Watermark/Watermark.png" "/Users/uName/Desktop/Test/Web/TTK_VW06 b.jpg"
  • ./nconvert -wmopacity 7 -wmflag center -wmsize 98 -wmfile "/Users/uName/Desktop/Watermark/Watermark.png" "/Users/uName/Desktop/Test/Web/TTK_VW06 b.jpg"
  • "/Users/uName/NConvert/nconvert" -wmopacity 7 -wmflag center -wmsize 98 -wmfile "/Users/uName/Desktop/Watermark/Watermark.png" "/Users/uName/Desktop/Test/Web/TTK_VW06 b.jpg"
I keep getting the error message:
"zsh: command not found: nconvert"

I'm more a graphics designer with some coding knowledge. What I deduce is that the "zsh" shell, does not recognize the command "nconvert". probably need to set "nconvert" so it can recognize it as a command. Even though the environment variable is set it most likely needs to be set some place else or there is another way to set environment variables for command line apps.
Last edited by mgegersdorfer on Mon May 01, 2023 3:17 pm, edited 2 times in total.
mgegersdorfer
Posts: 9
Joined: Sat Apr 29, 2023 7:52 am

Re: Help with nconvert on MacOS Catalina

Post by mgegersdorfer »

This command Is correct however I needed to "CD" into the dir where "nconvert" is located for it to work.
  • ./nconvert -wmopacity 7 -wmflag center -wmsize 98 -wmfile "/Users/uName/Desktop/Watermark/Watermark.png" "/Users/uName/Desktop/Test/Web/TTK_VW06 b.jpg"
I now see what looks like confirmation that nconvert is receiving input.

** NCONVERT v7.136 (c) 1991-2022 Pierre-E Gougelet (Jan 26 2023/09:46:46) **
Version for MacOS X (All rights reserved)
** This is freeware software (for non-commercial use)

Unfortunately I now get the following error message;
my_error_exit...<JPEG parameter struct mismatch: library thinks size is 632, caller expects 600>
my_error_exit...<JPEG parameter struct mismatch: library thinks size is 632, caller expects 600>
my_error_exit...<JPEG parameter struct mismatch: library thinks size is 632, caller expects 600>
my_error_exit...<JPEG parameter struct mismatch: library thinks size is 632, caller expects 600>
Error: Don't know how to read this picture (/Users/uName/Desktop/Test/Web/TTK_VW06 b.jpg)

This is a bit of an annoyance because I need to pass this code from a script to "nconvert"

I now have two questions:
  • How do I resolve the above error?
  • How do I pass this command from a script without needing to run CD first or how do I implement CD in one pass together with the nconvert command?
Last edited by mgegersdorfer on Sat Apr 29, 2023 2:40 pm, edited 1 time in total.
cday
XnThusiast
Posts: 4011
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Help with nconvert on MacOS Catalina

Post by cday »

You'll probably have to wait for Pierre for an answer, but have you tried a simpler action than watermark, and maybe a different source file format?
mgegersdorfer
Posts: 9
Joined: Sat Apr 29, 2023 7:52 am

Re: Help with nconvert on MacOS Catalina

Post by mgegersdorfer »

It worked for a tif image, no problem. It came back with "OK" and a photo with watermark is produced.
  • nconvert -wmopacity 7 -wmflag center -wmsize 95 -wmfile "/Users/uName/Desktop/Watermark/Watermark.png" "/Users/uName/Desktop/Test/Print/TTK-AL01 a.tif"
The command below produces the same error message as before(I think maybe the jpeg plugin aint being referenced);
  • nconvert -wmopacity 7 -wmflag center -wmsize 95 -wmfile "/Users/matthew/Desktop/Watermark/Watermark.png" "/Users/matthew/Desktop/Test/Web/TTK-AL01 a.jpg"
  • nconvert -ratio -rtype lanczos -resize 50% 50% "/Users/matthew/Desktop/Test/Web/TTK-AL01 a.jpg"
I'm using the standalone "nconvert" copied into "/Applications/NConvert". I do have XnViewMP installed but was not able to find nconvert. I also tried XnConvert was a failed attempt.
cday
XnThusiast
Posts: 4011
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Help with nconvert on MacOS Catalina

Post by cday »

You could maybe report the XnConvert bug with steps to reproduce and if possible test file(s) as that should be easy to describe clearly, and also cross-reference this thread.
mgegersdorfer
Posts: 9
Joined: Sat Apr 29, 2023 7:52 am

Re: Help with nconvert on MacOS Catalina

Post by mgegersdorfer »

RESOLVED! How do I pass this command from a script without needing to run CD first or how do I implement CD in one pass together with the nconvert command?

I realized I incorrectly declared the environment variable earlier.
I was declaring it as follows. I did not add it to the "PATH", which I was supposed to do. I was overthinking it!
echo 'export nconvert=/Users/matthew/NConvert/' >> ~/.zshev

The following is the correct procedure:
  • Download the standalone "nconvert" and extract it.
  • Copy/Move the "NConvert" folder to a directory of your choice(I used "/Applications")
  • Set the environment variable as follows(changing "/Applications/NConvert" to the folder of your choice. keep the "PATH" or it will not work):
    echo 'export PATH=/Applications/NConvert' >> ~/.zshenv
I can now use the "nconvert", without "CD"ing to the dir and without "./" at the beginning of "nconvert"
Last edited by mgegersdorfer on Sat Apr 29, 2023 3:01 pm, edited 1 time in total.
cday
XnThusiast
Posts: 4011
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Help with nconvert on MacOS Catalina

Post by cday »

mgegersdorfer wrote: Sat Apr 29, 2023 2:33 pm How do I pass this command from a script without needing to run CD first or how do I implement CD in one pass together with the nconvert command?
I am sorry, I am not a Mac user, only very basic Windows scripting with an aspiration when I have time to be able to script in my now much-preferred Linux! :wink:
mgegersdorfer
Posts: 9
Joined: Sat Apr 29, 2023 7:52 am

Re: Help with nconvert on MacOS Catalina

Post by mgegersdorfer »

cday wrote: Sat Apr 29, 2023 2:28 pm You could maybe report the XnConvert bug with steps to reproduce and if possible test file(s) as that should be easy to describe clearly, and also cross-reference this thread.
This is not an XnConvert bug. I don't have this issue with XnConvert nor XnViewMP. Did you mean I should report this bug over in a another thread because nconvert does not have a dedicated Bug Report Thread? If that was the case, then did you mean the Bug Report thread for XnViewMP thread? because I don't see a dedicated Bug Report thread for XnConvert either.
mgegersdorfer
Posts: 9
Joined: Sat Apr 29, 2023 7:52 am

Re: Help with nconvert on MacOS Catalina

Post by mgegersdorfer »

cday wrote: Sat Apr 29, 2023 2:53 pm
mgegersdorfer wrote: Sat Apr 29, 2023 2:33 pm How do I pass this command from a script without needing to run CD first or how do I implement CD in one pass together with the nconvert command?
I am sorry, I am not a Mac user, only very basic Windows scripting with an aspiration when I have time to be able to script in my now much-preferred Linux! :wink:
Not to worry I resolved this issue :D :wink: :D