NConvert useage: option -n

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

Moderators: XnTriq, helmut, xnview

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

NConvert useage: option -n

Postby cday » Tue Mar 01, 2016 6:54 pm

Could someone please provide an explanation for the operation of the following option listed in the help file:

Code: Select all

-n start end step : Begin End Step (for image sequence)

The option dates back to the early days of NConvert, but I am unable to find any explanation of its operation, intended useage or example of its use through searching the forum or a Google search...

Our forum librarian, who has uncanny search powers :?:

Helmut who was any early NConvert user :?:

User avatar
oops66
XnThusiast
Posts: 1998
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: NConvert useage: option -n

Postby oops66 » Tue Mar 01, 2016 7:32 pm

Hello ... A sample with option -n is into the xnview wiki, did not help?
http://www.xnview.com/wiki/index.php/NC ... User_Guide

Code: Select all

    ou can use it with images sequences.
For example, to convert the files file00.pic, file01.pic, ..., file10.pic and we convert to jpeg format with the name pattern res0.jpg, res1.jpg, ... type :
nconvert -out jpeg -n 1 10 1 -o res#.jpg file##.pic
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

User avatar
XnTriq
Moderator & Librarian
Posts: 4819
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: NConvert useage: option -n

Postby XnTriq » Tue Mar 01, 2016 8:00 pm

Hi cday :-)
This is what I've got (so far):

XnView Wiki (NConvert User Guide) wrote:You can use it with images sequences.
For example, to convert the files file00.pic, file01.pic, ..., file10.pic and we convert to jpeg format with the name pattern res0.jpg, res1.jpg, ... type :

Code: Select all

nconvert -out jpeg -n 1 10 1 -o res#.jpg file##.pic

SS64 (Windows CMD » FOR - Looping commands) wrote:syntax-FOR-List of numbers
FOR /L %%parameter IN (start,step,end) DO command


<edit> Chapeau, Monsieur oops66 ! </edit>

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert useage: option -n

Postby cday » Tue Mar 01, 2016 8:03 pm

oops66 wrote:Hello ... A sample with option -n is into the xnview wiki, did not help?

http://www.xnview.com/wiki/index.php/NC ... User_Guide

Code: Select all

You can use [NConvert] with images sequences.
 
For example, to convert the files file00.pic, file01.pic, ..., file10.pic and ... to jpeg format with the name pattern res0.jpg, res1.jpg, ... type :

nconvert -out jpeg -n 1 10 1 -o res#.jpg file##.pic

[Code edited to increase clarity.]

Thank you, that didn't show up in my searches, and the Wiki's are not a resource I normally think to turn to as they are often very limited or out of date.

That confirms the use of -n but I think I might have to do some tests to fully understand it...

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert useage: option -n

Postby cday » Tue Mar 01, 2016 8:08 pm

And thanks also to XnTriq whose usual wealth of links will hopefully provide some further insight... :D

User avatar
XnTriq
Moderator & Librarian
Posts: 4819
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: NConvert useage: option -n

Postby XnTriq » Wed Mar 02, 2016 3:30 am

cday wrote:Thank you, that didn't show up in my searches, and the Wiki's are not a resource I normally think to turn to as they are often very limited or out of date.

As it turns out, this info was transferred from Usage.txt to the Wiki.

nconvert command line option Japanese translation wrote:You read the file with a serial number. Option is to condition such as "-n 1 15", "- n [start number] [end number]" Please enter in the format.

User avatar
oops66
XnThusiast
Posts: 1998
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: NConvert useage: option -n

Postby oops66 » Wed Mar 02, 2016 11:24 am

cday wrote:...Thank you, that didn't show up in my searches, and the Wiki's are not a resource I normally think to turn to as they are often very limited or out of date.
That confirms the use of -n but I think I might have to do some tests to fully understand it...
Hello Cday & Xntriq, you're welcome ... yes some others tests are needed too.
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert useage: option -n

Postby cday » Wed Mar 02, 2016 7:40 pm

Code: Select all

-n start end step : Begin End Step (for image sequence)

http://www.xnview.com/wiki/index.php/NC ... User_Guide[/url]

You can use [NConvert] with images sequences.

For example, to convert the files file00.pic, file01.pic, ..., file10.pic and ... to jpeg format with the name pattern res0.jpg, res1.jpg, ... type :

nconvert -out jpeg -n 1 10 1 -o res#.jpg file##.pic

I've been doing some [limited] tests and -n only seems to work correctly for step=1, depending on what behaviour is expected.

With 20 input files numbered test-01 to test-19 and step=2 only alternate input files are converted:

Code: Select all

nconvert -out png -n 1 20 2 -o Output-##.png test-##.png

Image_1.png

With end=40 again only alternate input files are converted, with an error message:

Code: Select all

nconvert -out png -n 1 40 2 -o Output-##.png test-##.png

Image_2.png

Am I missing something?

Edit

It looks as though step refers to the *input* file numbers, so there is no way to increment *output* file names other than by 1?

Wouldn't the expected behaviour be for all the input files to be processed, with the step applied to the output names?

That isn't really clear in the help file, if it is the case...

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert useage: option -n

Postby cday » Wed Mar 02, 2016 10:25 pm

Please see the edit added at the end of the previous post!

User avatar
oops66
XnThusiast
Posts: 1998
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: NConvert useage: option -n

Postby oops66 » Wed Mar 02, 2016 10:53 pm

cday wrote:Please see the edit added at the end of the previous post!

... FYI, same issue uneder Linux version NCONVERT v6.17

Code: Select all

nconvert -out png -n 1 20 2 -o Output-##.png test-##.png

** NCONVERT v6.17 (c) 1991-2011 Pierre-E Gougelet (Sep 17 2012/10:50:01) **
        Version for Linux x86 (X11)  (All rights reserved)
** This is a freeware software (for non commercial use)

Conversion of test-01.png into Output-01.png OK
Conversion of test-03.png into Output-03.png OK
Conversion of test-05.png into Output-05.png OK
Conversion of test-07.png into Output-07.png OK
Conversion of test-09.png into Output-09.png OK
Conversion of test-11.png into Output-11.png OK
Conversion of test-13.png into Output-13.png OK
Conversion of test-15.png into Output-15.png OK
Conversion of test-17.png into Output-17.png OK
Conversion of test-19.png into Output-19.png OK
$
nconvert -out png -n 1 40 2 -o Output-##.png test-##.png
Conversion of test-01.png into Output-01.png OK
Conversion of test-03.png into Output-03.png OK
Conversion of test-05.png into Output-05.png OK
Conversion of test-07.png into Output-07.png OK
Conversion of test-09.png into Output-09.png OK
Conversion of test-11.png into Output-11.png OK
Conversion of test-13.png into Output-13.png OK
Conversion of test-15.png into Output-15.png OK
Conversion of test-17.png into Output-17.png OK
Conversion of test-19.png into Output-19.png OK
Conversion of test-21.png into Output-21.png OK
Conversion of test-23.png into Output-23.png OK
Conversion of test-25.png into Output-25.png OK
  Error: Can't open file (test-27.png)
  Error: Can't open file (test-29.png)
  Error: Can't open file (test-31.png)
  Error: Can't open file (test-33.png)
  Error: Can't open file (test-35.png)
  Error: Can't open file (test-37.png)
  Error: Can't open file (test-39.png)
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

User avatar
xnview
Author of XnView
Posts: 27030
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: NConvert useage: option -n

Postby xnview » Thu Mar 03, 2016 9:22 am

-n replace ## by the range/step specified, in your test it works for step 2
Pierre.

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert useage: option -n

Postby cday » Thu Mar 03, 2016 9:29 am

xnview wrote:-n replace ## by the range/step specified, in your test it works for step 2

Thanks, could you please post an edited version of my command line?

User avatar
oops66
XnThusiast
Posts: 1998
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: NConvert useage: option -n

Postby oops66 » Thu Mar 03, 2016 10:20 am

cday wrote:
xnview wrote:-n replace ## by the range/step specified, in your test it works for step 2
Thanks, could you please post an edited version of my command line?
... I think Pierre's saying than the errors are normal, because -n replace ## (but only/mostly for the inputs files) ;-)
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

cday
XnThusiast
Posts: 1365
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: NConvert useage: option -n

Postby cday » Thu Mar 03, 2016 10:42 am

oops66 wrote:I think Pierre's saying than the errors are normal, because -n replace ## (but only/mostly for the inputs files) ;-)

Well, O.K., but ## appears in two places in the command line...

But perhaps this shines at least a little light on a seemingly little known and probably rarely used NConvert option... :?:

User avatar
oops66
XnThusiast
Posts: 1998
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: NConvert useage: option -n

Postby oops66 » Thu Mar 03, 2016 11:38 am

cday wrote:... But perhaps this shines at least a little light on an seemingly little known and probably rarely used NConvert option... :?:
... Right, this -n option is not well explained into the help (nconvert -help), and the wiki example is not the good one too.
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64


Return to “NConvert”

Who is online

Users browsing this forum: No registered users and 1 guest