NConvert script outputting multiple errors

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

Moderators: XnTriq, helmut, xnview

Post Reply
felipe4334
Posts: 14
Joined: Mon Nov 07, 2016 4:42 pm

NConvert script outputting multiple errors

Post by felipe4334 »

Hello. I'm having trouble getting an NConvert script working, I create a job on XnConvert and made everything I wanted. I exported the job as an NConver script but, when I run it, it give many errors and it creates multiple versions of the files provided. All I want the script to do is to open a file then do what I have one it then output the processed file.

This is the script XnConvert gave me to use for NConver.

Code: Select all

nconvert -text_font ADAM.CG PRO 111 -text_color 111 255 255 -text_back 255 0 0 -text_flag center -text_pos 0 0 -text_rotation 0 -text "nameOfPlayerYoutubeEdited" -text_font ADAM.CG PRO 44 -text_color 44 255 0 -text_back 0 0 0 -text_flag bottom-center -text_pos 0 -127 -text_rotation 0 -text "KDAOfPlayer" -text_font ADAM.CG PRO 52 -text_color 52 249 249 -text_back 249 0 0 -text_flag bottom-center -text_pos 0 -10 -text_rotation 0 -text "League Of Legends" -wmopacity 100 -wmfile "D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\400x400.png" -wmflag top-left -wmopacity 100 -wmfile "D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\challenger_1.png" -wmflag top-left 
And this is the errors I'm getting.

Code: Select all

** NCONVERT v6.93 (c) 1991-2016 Pierre-E Gougelet (Oct 11 2016/20:19:33) **
        Version for Windows Xp/Vista/7 x64  (All rights reserved)
** This is freeware software (for non-commercial use)

  Error: Can't open file (111)

  Error: Can't open file (-text_color)

  Error: Can't open file (111)

  Error: Can't open file (255)

  Error: Can't open file (255)

  Error: Can't open file (-text_back)

  Error: Can't open file (255)

  Error: Can't open file (0)

  Error: Can't open file (0)

  Error: Can't open file (-text_flag)

  Error: Can't open file (center)

  Error: Can't open file (-text_pos)

  Error: Can't open file (0)

  Error: Can't open file (0)

  Error: Can't open file (-text_rotation)

  Error: Can't open file (0)

  Error: Can't open file (-text)

  Error: Can't open file (nameOfPlayerYoutubeEdited)

  Error: Can't open file (-text_font)

  Error: Can't open file (ADAM.CG)

  Error: Can't open file (PRO)

  Error: Can't open file (44)

  Error: Can't open file (-text_color)

  Error: Can't open file (44)

  Error: Can't open file (255)

  Error: Can't open file (0)

  Error: Can't open file (-text_back)

  Error: Can't open file (0)

  Error: Can't open file (0)

  Error: Can't open file (0)

  Error: Can't open file (-text_flag)

  Error: Can't open file (bottom-center)

  Error: Can't open file (-text_pos)

  Error: Can't open file (0)

  Error: Can't open file (-127)

  Error: Can't open file (-text_rotation)

  Error: Can't open file (0)

  Error: Can't open file (-text)

  Error: Can't open file (KDAOfPlayer)

  Error: Can't open file (-text_font)

  Error: Can't open file (ADAM.CG)

  Error: Can't open file (PRO)

  Error: Can't open file (52)

  Error: Can't open file (-text_color)

  Error: Can't open file (52)

  Error: Can't open file (249)

  Error: Can't open file (249)

  Error: Can't open file (-text_back)

  Error: Can't open file (249)

  Error: Can't open file (0)

  Error: Can't open file (0)

  Error: Can't open file (-text_flag)

  Error: Can't open file (bottom-center)

  Error: Can't open file (-text_pos)

  Error: Can't open file (0)

  Error: Can't open file (-10)

  Error: Can't open file (-text_rotation)

  Error: Can't open file (0)

  Error: Can't open file (-text)

  Error: Can't open file (League Of Legends)

  Error: Can't open file (-wmopacity)

  Error: Can't open file (100)

  Error: Can't open file (-wmfile)

Conversion of D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\400x400.png into D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\400x400_1.png OK
  Error: Can't open file (-wmflag)

  Error: Can't open file (top-left)

  Error: Can't open file (-wmopacity)

  Error: Can't open file (100)

  Error: Can't open file (-wmfile)

libpng warning: iCCP: known incorrect sRGB profile
Conversion of D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\challenger_1.png into D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\challenger_1_1.png OK
  Error: Can't open file (-wmflag)

  Error: Can't open file (top-left)
Any help would be great thanks.
I'm new to this I know it might be a input error since it says can't open file as if it thinks thats the file to input but I don't know how to fix it.
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Help, NConvert script outputting multiple errors.

Post by cday »

felipe4334 wrote:Hello. I'm having trouble getting an NConver script working, I created a job on XnConvert and made everything I wanted. I exported the job as an NConvert script but, when I run it, it gives many errors...
Code exported from XnConvert only contains the code for the selected actions, and doesn't include the required input and output terms, although that isn't stated, so you need to add those terms...

The input term must come last in the code, the output term including any required compression can normally be placed before that, or could I think probably be placed more or less anywhere in the code.

You will need to consult the NConvert help file, and it might be helpful to look at examples of code posted in the NConvert section of the forum; it might also be easier to test a minimal code such as just a simple rotation of the input image(s) and get that working first.

Do you wish to create a batch file, or run your code at the command line? If you need further help could you indicate the form of input and outputs you require?
felipe4334
Posts: 14
Joined: Mon Nov 07, 2016 4:42 pm

Re: Help, NConvert script outputting multiple errors.

Post by felipe4334 »

cday wrote:
felipe4334 wrote:Hello. I'm having trouble getting an NConver script working, I created a job on XnConvert and made everything I wanted. I exported the job as an NConvert script but, when I run it, it gives many errors...
Code exported from XnConvert only contains the code for the selected actions, and doesn't include the required input and output terms, although that isn't stated, so you need to add those terms...

The input term must come last in the code, the output term including any required compression can normally be placed before that, or could I think probably be placed more or less anywhere in the code.

You will need to consult the NConvert help file, and it might be helpful to look at examples of code posted in the NConvert section of the forum; it might also be easier to test a minimal code such as just a simple rotation of the input image(s) and get that working first.

Do you wish to create a batch file, or run your code at the command line? If you need further help could you indicate the form of input and outputs you require?
I'm just trying to import a .jpg file, do whats on the script and output the file with a name to another folder with the same format .jpg.
I will use the commands on a command line since is the only way I can use variables.
felipe4334
Posts: 14
Joined: Mon Nov 07, 2016 4:42 pm

Re: NConvert script outputting multiple errors

Post by felipe4334 »

Code: Select all

nconvert -o "OutPutName.jpg" -text_font ADAM.CG PRO 111 -text_color 111 255 255 -text_back 255 0 0 -text_flag center -text_pos 0 0 -text_rotation 0 -text "nameOfPlayerYoutubeEdited" -text_font ADAM.CG PRO 44 -text_color 44 255 0 -text_back 0 0 0 -text_flag bottom-center -text_pos 0 -127 -text_rotation 0 -text "KDAOfPlayer" -text_font ADAM.CG PRO 52 -text_color 52 249 249 -text_back 249 0 0 -text_flag bottom-center -text_pos 0 -10 -text_rotation 0 -text "League Of Legends" -wmopacity 100 -wmfile "D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\400x400.png" -wmflag top-left -wmopacity 100 -wmfile "D:\Dropbox\Projects\Bot\Record Games\Lolking\replays\test\challenger_1.png" -wmflag top-left *.jpg
I added The input and output files and still getting many errors, even when I made the code very short it still gives Can't open file.
felipe4334
Posts: 14
Joined: Mon Nov 07, 2016 4:42 pm

Re: NConvert script outputting multiple errors

Post by felipe4334 »

Ok I found a bit of a fix, the main problem is using -text_font ADAM.CG PRO 52, somehow its giving errors when using any type of font command. If I make it -text_font ADAM.CG PRO52 it does not give errors but the front and the size does not work.
felipe4334
Posts: 14
Joined: Mon Nov 07, 2016 4:42 pm

Re: NConvert script outputting multiple errors

Post by felipe4334 »

Ok, I found the errors, the problem was the font name, Nconvert did not like spaces in the font name, I think this might be a bug on XnConvert, It should remove the spaces automatically.
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert script outputting multiple errors

Post by cday »

felipe4334 wrote:Ok, I found the errors, the problem was the font name, Nconvert did not like spaces in the font name...
Glad you've found a solution, it was difficult to help more without knowing more about what you wanted to do.
felipe4334 wrote:Nconvert did not like spaces in the font name ... It should remove the spaces automatically.
The font file name can be placed in quotes "..." I think, which as a general solution to spaces in code terms would be a better solution...

Edit:

If the font name on your system has a space, I'm surprised that if the space is removed the code runs; quoting the name would be the usual solution, I think.
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: NConvert script outputting multiple errors

Post by XnTriq »

miksmith ([url=http://newsgroup.xnview.com/viewtopic.php?p=129297#p129297]Adding Text: Command line??[/url]) wrote:The font, color and positioning all work (for fonts with spaces in the names you need to put them in quotations).
EuM_Expert ([url=http://newsgroup.xnview.com/viewtopic.php?p=108760#p108760]nconvert 6.21 does not expand parameters of add_text[/url]) wrote:Sideline: as described in http://newsgroup.xnview.com/viewtopic.php?f=57&t=26999, the save as function is buggy for the font specification, because the font name should be included in double quotes, and the font size must be specified, e.g."

Code: Select all

-text_font "Courier New" 30
Post Reply