How to use NConvert

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

Moderators: XnTriq, helmut, xnview

User avatar
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

How to use NConvert

Post by helmut »

Below please find info regarding "NConvert", the command line tool for image conversion and manipulation.

What is NConvert for?
XnView is a GUI-based application, you can change and manipulate images using a graphical user interface. NConvert has about the same capabilities as XnView, but it is a command line tool and has no graphical user interface. You can use NConvert in Batch scripts or another application can call it.

Typically, NConvert is used for automated conversion of images, e.g., by running a script, all images in a specific folder could be sharpened and reduced in size and then saved in a special folder.

XnView can also do Batch Conversions, which is sufficient for most purposes. Please have a look at topic "How to convert several images at once" for more details.

How is NConvert used?
NConvert is started from the command line or called by batch scripts.
You tell NConvert what to do using the command line options, e.g...

Code: Select all

nconvert -i sample.gif -o tif
...will convert the file "sample.gif" to TIF format.

Naturally, using command line options for specifying what to do is more complicated than simply clicking on a menu entry or selection and having a preview in XnView.

Where do I get NConvert?
NConvert is included in the Complete package of XnView. If you have downloaded and installed the Minimal package or Standard Package, you can download NConvert separately on the normal XnView Download page. For installation, unpack NConvert in program folder of XnView (C:\Program Files\xnview). NConvert consists of one single file "nconvert.exe". The other files in the "NConvert" package are ReadMe and other informational files.

How can I learn more about NConvert's options?
There are various ways to find out about the usage and options available in NConvert:

a.) NConvert's help info
NConvert has a short built-in help info. On the command line, you specify

Code: Select all

"C:\Program Files\xnview\nconvert -help | more"
This will redirect the output to "more" which will show the output page by page. You can also redirect output to a file (e. g. "C:\Program Files\xnview\nconvert -help > nconvert.txt") and then open the help in any text editor. This output is also listed in topic "Command line options of NConvert".

- "more" is not an option of XnView, but a DOS program which simply outputs the input it gets page by page. By using the character "|", the output of any DOS program (here: nconvert) can be piped (=directed) to another program (here: more).

- You open a command line window using Start > Programs > Accessories > Command prompt .

b.) Export a script for NConvert in XnView
Most options of NConvert have the same name as in the user interface of XnView. So you can start XnView, open an image, and have a look at the filters and effects available. For example, 'Filter->Blur->Average' maps to the -average option.

You can use XnView and comfortably create the script for NConvert. As you might know, you can do Batch Conversion in XnView. See FAQ "How to convert several images at once". If you are happy with the result of your Batch Conversion and want to use it as template for an automatic conversion using NConvert, you can export it by clicking on the "Export Batch for NConvert" button.

c.) Have a look at existing scripts
In this forum group, various "NConvert" questions have been posed and answered. It's worthwhile reading existing posts. You can just browse the topic titles or use the "Search" function on this board and limit your search to the forum group "NConvert", if needed.

This is surely just a basic introduction. More info on how to use the command prompt and batch scripting in general can be found by searching the web.

My batch script does not run!
It might be very hard for novices to create their first batch script, or even to get the command line running. For example, you might receive an error message "Bad command or filename". The reason for this is that the command "nconvert" is not found. You have to either specify the path "C:\Program Files\XnView\nconvert.exe" or set your environment variable "PATH".
Batch scripting and using the command line is not trivial. There are many more possible problems and traps, far too many to list or explain here. Before posting a general problem regarding command line or batch scripting here, please try to find out a solution using the web. There are many info sites (maybe even free books) available on the Internet.

- As written above "NConvert" is not as easy to use as XnView. If you think an important fact is missing in this FAQ, please let me know.
- Some info is taken from other topics, e.g., "Overwite files.. which parameter?"