Using a xbs file as an input to NConvert

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

Moderators: XnTriq, helmut, xnview

Post Reply
marcgii
Posts: 4
Joined: Wed Nov 14, 2018 12:48 am

Using a xbs file as an input to NConvert

Post by marcgii »

So I have a xbs file which has the complete convert configuration I want to use. Can use this file as a input to nConvert? It doesn't seem that I can. I had also hoped to use the export to batch function, but that doesn't include any of the output format options. It only included the resize options.

At the moment, all I'm trying to do is convert and resize a single specified image, and specify the output location. What is the best way to accomplish this using only scripts? If the only way is figuring out the nconvert syntax, can someone assist? I didn't find the "user guide" to be particularly helpful.

Below is basically what I have so far. It doesn't work right. I have attached a screenshot of xbs config file. Any help would be appreciated.

Code: Select all

nconvert -out jpeg -q 75 -opthuff -dct value 2 -smoothingf value 0 -subsampling value 2 -keepcspace -ratio -rtype lanczos -rflag decr -resize 10000 2800  -o "D:\Test\output.jpeg" "D:\Test\input.png"
Attachments
Capture.PNG
cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Using a xbs file as an input to nConvert?

Post by cday »

marcgii wrote: Wed Nov 14, 2018 2:14 am So I have a xbs file which has the complete convert configuration I want to use. Can use this file as a input to nConvert? It doesn't seem that I can. I had also hoped to use the export to batch function, but that doesn't include any of the output format options. It only included the resize options.
I have no experience of the xbs export option, and as you say the export for NConvert option doesn't include the required input and output code. However, those shouldn't be hard to add. I believe the code exported from batch convert also often includes terms that are not in fact needed, possibly because the values are default values when NConvert is run.

At the moment, all I'm trying to do is convert and resize a single specified image, and specify the output location. What is the best way to accomplish this using only scripts? If the only way is figuring out the nconvert syntax, can someone assist?
I would suggest that you start by getting a minimal code running, and then add additional options one by one until you have final code that meets your needs. The following code that just reads the source PNG file and outputs a similar JPEG file should run without any difficulty: if it doesn't, stop and describe the problem you encounter if you are unable to overcome it.

Code: Select all

nconvert -out jpeg -q 75  -o "D:\Test\output.jpeg" "D:\Test\input.png"

When that code runs add the required resize option, and when that works any other options you actually need one by one; if you encounter a problem stop and try to overcome it, if necessary by liberal use of trial and error experimentation, and then if necessary post the issue you have encountered.

Note: If you don't have a copy of the NConvert help file you should create one, or if necessary consult the [least out of date] version in the NConvert section of the forum.
User avatar
xnview
Author of XnView
Posts: 43444
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Using a xbs file as an input to NConvert

Post by xnview »

no you need to export the xbs as a nconvert bat
Pierre.
marcgii
Posts: 4
Joined: Wed Nov 14, 2018 12:48 am

Re: Using a xbs file as an input to NConvert

Post by marcgii »

It turns out the issue with the code was simply that I had the switches wrong. If anyone is curious the correct is:

Code: Select all

nconvert -out jpeg -q 75 -opthuff -dct 2 -smoothingf 0 -subsampling 2 -keepcspace -ratio -rtype lanczos -rflag decr -resize 10000 2800  -o "D:\Test\output.jpeg" "D:\Test\input.png"
marcgii
Posts: 4
Joined: Wed Nov 14, 2018 12:48 am

Re: Using a xbs file as an input to NConvert

Post by marcgii »

xnview wrote: Thu Nov 15, 2018 9:01 am no you need to export the xbs as a nconvert bat
As I mentioned before, the export to Batch file function doesn't export image conversion settings. So what exactly is the intended use case for the function?
User avatar
xnview
Author of XnView
Posts: 43444
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Using a xbs file as an input to NConvert

Post by xnview »

marcgii wrote: Sat Nov 17, 2018 2:17 pm
xnview wrote: Thu Nov 15, 2018 9:01 am no you need to export the xbs as a nconvert bat
As I mentioned before, the export to Batch file function doesn't export image conversion settings. So what exactly is the intended use case for the function?
yes only actions. But what do you want to do? You would like to use your .xbs as command lie?
Pierre.
marcgii
Posts: 4
Joined: Wed Nov 14, 2018 12:48 am

Re: Using a xbs file as an input to NConvert

Post by marcgii »

xnview wrote: Tue Nov 20, 2018 7:13 am yes only actions. But what do you want to do? You would like to use your .xbs as command lie?
Okay so it's only actions. It would be nice if it could also export your conversion configuration settings. I don't see any reason to limit the export function to only actions. If I could use the .xbs file (which includes actions and encoder settings) as an input, that would have been a work around to get nconvert working without having spend much time figuring out the needed commands and syntax. That's the reason I was asking.
User avatar
xnview
Author of XnView
Posts: 43444
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Using a xbs file as an input to NConvert

Post by xnview »

ok, i'll check to save output format settings
Pierre.
Post Reply