2JPEG Command Line Syntax

2JPEG software is an advanced image converter. It can convert almost any image or document to the JPG format in batch mode. 

Command line syntax described below allows choosing the source folder with files you need to convert, selecting image editing operations, setting the destination folder path, changing the rules for naming output files, and much more.

Quick start batch conversion to JPEG

  1. Press Win+R on your keyboard, type cmd and press Enter to open the Command Prompt (CMD).Press Enter to open the Command Prompt (CMD)
  2. To call 2JPEG interface prompt, type 2jpeg.exe and press Enter. This way you can view an entire list of available operations and options.
    Quick start batch conversion to JPG with 2jpeg.exe
  3. The command lines have switches and parameters with values, which can be added after 2jpeg.exe. The basic 2JPEG command is:
    2jpeg.exe -src "C:\In\*.*" -dst "C:\Out"
  4. Press Enter to execute the command.

-src should be followed by the source folder path with files to be converted or path to the input file;

-dst should be followed by the destination folder path for output files;

Asterisk (star, *) is a wildcard character which stands for any string of characters or no characters at all. *.* stands for any filename – point – any file extension;

When specifying the source folder path (or source file) and destination path (output folder) – enclose them in double quotation marks. Example:
-src "C:\Incoming files\For conversion\Invoice.docx";

More switches and parameters with values can be added to the basic command. See the Switches section.

Command line structure and examples

The basic command line structure sets the source for files and the destination path. After them you can add optional parameters for output JPEG files such as compression, resolution, page autorotation, and more.

2JPEG command line syntax structure is:

2jpeg.exe -<switch1> [param1:value paramN:value] -<switchN> [parameters]

Command line examples:

2jpeg.exe -src "C:\In\*.pdf" -dst "C:\Out" -oper resize size:"800 600" -options pages:"1,3,5-16,25" scansf:no

2jpeg.exe -src "@C:\In\list.txt" -dst "C:\Out" -oper textwatermark text:"(C) John Smith"

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options srcpwd:"my password"

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options overwrite:yes

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options overwrite:skip

Switches

SwitchDescription
-src

Source for files. A source can be:

  • Folder path where files are located
  • Path to a single file
  • Path to a list with file destinations (TXT)
  • Web address (URL)

When specifying a folder path, add *.* in the end. For example,  -src "C:\Files\*.*"  To allow processing certain files, enter file extension, e.g., -src "C:\Files\*.docx" to convert DOCX files only.

If you have a list of files to convert, it should be saved as a TXT file. To set a list of files as a source, use @ before the file path. For example: -src "@C:\Files\list.txt"

When entering a URL to be used as a source, use the format below (don't forget to add https://www). If password entry is required to access the website, specify credentials as well – user and password.

-src https://www.2jpeg.com

-src https://www.mywebsite.com -options user:myusername password:mypassword

You can use multiple sources at once. Enter them after -src one after another within double quotation marks and separated by a space.

-dst

Destination folder path. For example:-dst "C:\Out". Input the output folder location within double quotation marks.

-jpeg

JPEG format parameters (-jpeg) – parameters related to the JPEG format. Changing these parameters is optional.

-oper

Image editing operations: add watermark, resize, crop, etc. Adding these operations is optional.

-postproc

Post-processing actions. Copy, move, or delete files automatically after processing, if necessary. Can apply both to successfully converted and failed files. Adding these actions is optional.

-fls

File loading settings. Control the settings of the original source files before processing.

-info

Information about a certain document.

-about

Information about the program. Displays license key and software version.

-ini

2JPEG Settings – default settings of the program available in the low-level settings editor with GUI controls.

-cmdline

Command line. Allows you to run the 2JPEG command from a TXT file, for example, if your command line is too large.

Example:
2jpeg.exe -cmdline "C:\Scripts\2JPEG command.txt"

Common options (-options)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for files which will be converted.

Applies to all pages by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options pages:1,3,5-12

all
scansf

Scan subdirectories and convert files from them, too (subfolder recursion).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options scansf:no

yes, no
keepsf

Restore subfolders structure. When enabled, it will keep the same subfolders in the output destination as in the input folder (if a folder is set as a source).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options keepsf:no

yes, no
mswildc

Enable/disable Microsoft DOS/Win32 wildcard matching algorithm. This algorithm is a bit different from the "expected" behavior, since some wildcards work in a different way in Windows (compared to Linux, for example).

For example, you may want to convert DOC files only. It would seem that you should just use this source: -src "C:\In\*.doc". But as a result, both .DOC and .DOCX files will be converted, which is not needed. To convert only files that match the specified file extension, disable this parameter.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options mswildc:no

yes, no
overwrite

Overwrite existing files or skip files with the same filename.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options overwrite:skip

no, yes, skip
break_on_error Stop the file conversion process in case of an error.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options break_on_error:yes

no, yes
template

Use a custom filename template for output files.

Automatically renames output files using a name template. By default, page counter ({*SrcFileMPageNo}) works only for multipage files split into separate pages.

Available macros:

  • {*SrcFilename} – source file name;
  • {*WorksheetName} – worksheet file name (for Excel and CAD source files only);
  • {*SrcFileMPageNo} – source file page number;
  • {*DstFileExt} – destination file extension.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options template:"Document-{*SrcFileMPageNo}.{*DstFileExt}"

{*SrcFilename}{*WorksheetName}{*SrcFileMPageNo}.{*DstFileExt}
srcpwd

Enter source file password(s).

2JPEG can convert password-protected Word and PDF files. Enter a password in this format: srcpwd:password

If a password contains spaces, enter it between double quotation marks. For example: srcpwd:"my password"

If you have files secured with more than one password, you can enter multiple passwords too. For example: srcpwd:password1 srcpwd:password2 srcpwd:password3

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options srcpwd:"my password"

Enter password(s) for source file(s)
res

Set resolution for image rasterization.

Define rasterization resolution for output JPEG files from 72 DPI to 4096 DPI. Use this parameter if you convert vector documents (PDF, Word DOC, etc.) to JPEG.

Example: 2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options res:600

300, 72-4096
attachments

Set up the method of processing of file attachments.

If you convert documents with attachments (emails with attachments, PDF Portfolio files), you can select how 2JPEG should handle them:

  • ignore – do not convert attachments
  • separate – save attachments as separate files
  • onlyatt – convert attachments only, ignore the document itself
  • combine – add attachments after the main document
  • combine_prepend – add attachments before the main document

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options attachments:combine_prepend

ignore, separate, onlyatt, combine, combine_prepend
sort

Sort converted files by a specific parameter such as name, date, type, size, or path. To sort the files in descending order, use values ending with _d (name_d, date_d, etc.).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options sort:type

unsorted, name, date, type, size, path, name_d, date_d, type_d, size_d, path_d
log

Create events log.

2JPEG saves log files in XML format containing information about the system and records of all events. We recommend having this parameter enabled because information contained in log files will help the developers quickly figure out what's happening in case of any error or issue.

yes, no
logpath

Set path to log files location.

By default, it is set to %TEMP% which usually opens the path "C:\Users\[User]\AppData\Local\Temp". You can set any other folder path to store log files elsewhere.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options logpath:"E:\2JPEG Logs"

%TEMP%
silent

Suppress console output and run file conversion silently without showing the process.

The console window's information will not be displayed during processing, and dialog windows will not appear.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options silent:yes

no, yes
alerts

Display alerts in case of an issue or error.

If it is set to "no", you will not see any dialog windows, such as asking to register the program's license (if the free trial version is used). However, the information on the console window will be displayed during processing.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options alerts:no

yes, no
user Enter username when converting files from the web.

Username (login) may be required to access the web page you want to convert if the URL is set as a source. Don't forget to specify both credentials – user and password.

Example:
2jpeg.exe -src https://www.mywebsite.com -dst "C:\Out" -options user:admin password:mypassword

Enter username (login)
password

Enter password when converting files from the web.

Password may be required to access the web page you want to convert if the URL is set as a source. Don't forget to specify both credentials – user and password.

Example:
2jpeg.exe -src https://www.mywebsite.com -dst "C:\Out" -options user:admin password:mypassword

Enter password

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -options pages:"1,3,5-12" scansf:no keepsf:no log:yes overwrite:yes template:"{Title}-page{Page}.jpg" sort:name silent:yes

JPEG format parameters (-jpeg)

ParameterDescriptionValue (values in bold are set by default)
bpp

Define JPEG image color depth (bits per pixel).

The number of bits is used to define the grayscale value or color value of a pixel.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg bpp:8

64, 48, 32, 24 (default value), 8, 4, 1
mode

Set compression mode: Baseline, Extended, Progressive or Lossless.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg mode:lossless

baseline, extended, progressive, lossless
quality

Set the JPEG quality for output files, in percentage.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg quality:100

85, 20-100
subsampling

Set YCbCr subsampling (chroma subsampling).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg subsampling:422

111, 422, 421, 442, 411
opthuff

Optimize Huffman tables.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg opthuff:yes

no, yes
interleaved

Interleave data structure.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg interleaved:no

no, yes
hres

Set custom horizontal resolution. You can change it to a custom DPI value.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg hres:200

-1 (default)
vres

Set custom vertical resolution. You can change it to a custom DPI value.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg vres:200

-1 (default)
save_meta

Save EXIF/IPTC/XMP information in output files.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg save_meta:yes

no, yes
thumbnail

Create thumbnail images out of output files.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -jpeg thumbnail:yes

no, yes

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -jpeg mode:progressive bpp:8 quality:50 subsampling:422 opthuff:yes interleaved:no save_meta:yes thumbnail:yes

Image editing operations (-oper)

Image watermark (-oper watermark)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for image watermark.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" pages:"1,3,5-12"

all
image

Set path to image watermark.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png"

Enter path to watermark
halign

Set horizontal alignment for image watermark.

Aligns image watermark horizontally: to the left, center, or right side of a sheet. Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" halign:center valign:center

left, center, right
valign

Set vertical alignment for image watermark.

Aligns image watermark vertically: to the top, center, or bottom of a sheet. Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" halign:right valign:bottom

top, center, bottom
units

Select units for horizontal and vertical offset values (offx, offy parameters): percents or pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" units:pixels offx:100 offy:-100

pixels, percents

offx

Set horizontal offset value (pixels/percent of the page width).

Shifts the watermark position horizontally using a specific value. Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" offx:20 offy:20

0
offy

Set vertical offset value (pixels/percent of the page height).

Shifts the watermark position vertically using a specific value. Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" offx:20 offy:20

0
size

Set watermark size.

Sets watermark size as a percent of source file's page height and width. For example, enter size:15 for 15%. -1 is the default value, which applies the watermark "as is" using the watermark's original size.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" size:15

-1 (default), 1-100
angle

Rotate the watermark at a specific angle.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" angle:45

0
direction

Select direction for watermark rotation: clockwise (CW) or counterclockwise (CCW).

Example:
2jpeg.exe -src "C:\In\*.*"-dst "C:\Out" -oper watermark image:"C:\Watermark.png" angle:45 direction:ccw

ccw, cw
method

Select a blending method for watermark: AlphaBlend or Overdraw.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" method:overdraw

alphablend, overdraw
zorder

Set Z-order for image watermark application.

You can place the watermark behind (background) or in front (foreground) of the document's contents.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark image:"C:\Watermark.png" zorder:background

foreground, background

Command line example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper watermark pages:"1,3-5" image:"C:\My logo.png" halign:center valign:center offx:10 offy:15

Text watermark (-oper textwatermark)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for text watermark.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" pages:1-3

all
text

Enter watermark text.

You can input any text within double quotation marks.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT"

Type any text

font

Select font for text watermark.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" font:Verdana

Arial
fontsize

Set font size in points.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" fontsize:30

12
fs_units

Select font size units: points or percentages of image height.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" fontsize:15 fs_units:percents

points, percents (percent of image height)
bold

Make the text watermark font bold.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" bold:yes

no, yes
italic

Make the text watermark font italic.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" italic:yes

no, yes
underline

Make the text watermark font underlined.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" underline:yes

no, yes
halign

Set horizontal alignment for text watermark.

Aligns text watermark horizontally: to the left, center, or right side of a sheet. Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" halign:center

left, center, right
valign

Set vertical alignment for text watermark.

Aligns image watermark vertically: to the top, center, or bottom of a sheet. Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" valign:bottom

top, center, bottom
units

Select units for horizontal and vertical offset (offx, offy parameters): percents or pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" units:pixels offx:100 offy:-100

pixels, percents
offx

Set horizontal offset for text watermark.

Shifts the watermark's position horizontally using a specific value (in pixels/percent of the page width). Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" offx:20 offy:15

0
offy

Set vertical offset for text watermark.

Shifts the watermark's position vertically using a specific value (in pixels/percent of the page width). Can be combined with other alignment and offset parameters.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" offx:20 offy:15

0
color

Set text color for text watermark.

Applies text color using RGBA color model – "r:(0-255),g:(0-255),b:(0-255);a:(0-255)".

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" color:"r:0,g:128,b:0,a:255"

"r:0,g:0,b:0,a:255" (black)
bgcolor

Set text background color for text watermark.

Applies text background color using RGBA color model – "r:(0-255),g:(0-255),b:(0-255);a:(0-255)".

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" bgcolor:"r:0,g:128,b:0,a:255"

"r:255,g:255,b:255,a:255" (white)
angle

Set text watermark rotation angle.

Rotates the text watermark at a specific angle. You can select any arbitrary angle.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" angle:45

0
direction

Select direction of rotation for text watermark: clockwise (CW) or counterclockwise (CCW).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" angle:45 direction:ccw

ccw, cw
border

Draw a border around the text watermark.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" border:yes

no, yes
fit

Fit the text watermark into the image.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" border:yes fit:yes

no, yes
method

Use a certain blending method when watermarking: AlphaBlend or Overdraw.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" method:overdraw

alphablend, overdraw
zorder

Set Z-order for text watermark application.

Places the watermark behind (background) or in front (foreground) of the document's contents.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark text:"DRAFT" zorder:background

foreground, background

Command line example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper textwatermark pages:"1,3-5" text:"(C) John Smith" font:"Verdana" fontsize:25 bold:yes italic:yes underline:yes halign:center valign:center offx:10 offy:15 color:"r:255,g:0,b:0,a:128" bkcolor:"r:0,g:255,b:0,a:128" angle:45 border:yes

Resize (-oper resize)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range which will be resized.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize pages:1-3

all
size

Set a new size of the image (width and height).

Defines width and height dimensions (in pixels) for file resizing. The source file proportions are kept.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"100 100"

"0 0"
units

Select units for setting resize values.

Uses pixels or percents as units for resize operation.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"50" units:percents

pixels, percents
fmode

Select Fit mode.

Applies page scaling to fit a specific size. Available values:

  • fit_in_size – Fit the size specified for the size: parameter. Oversized images will be shrunk to the defined width and height, and small ones will be enlarged to fit the page size;
  • thumbnail – Fit the size of a thumbnail;
  • fill_in_size – Fill the size specified for the size: parameter. The image will be positioned on the entire sheet by the smaller side (the longer side may go beyond the defined area);
  • fit_width – Fit the size specified for the size: parameter by width;
  • fit_height – Fit the size specified for the size: parameter by height.

Example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"300 300" fmode:fill_in_size

fit_in_size, thumbnail, fit_width, fit_height, fill_in_size, none
falign

Select Fit alignment.

Aligns the resized image to the center, left top corner, or right bottom corner.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"300 300" fmode:thumbnail falign:right_bottom

center, left_top, right_bottom
nozoom

Disable making the image larger than the original size.

Setting to "yes" will prevent image upscaling to meet the defined size dimensions.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"300 300" fmode:fill_in_size nozoom:yes

no, yes
method

Select image resampling method.

Applies the nearest neighbor or bilinear interpolation resampling method for image resizing.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"300 300" method:neighbour

bilinear, neighbour
color

Fill blank margins around the resized image with color.

Fills blank margins around the resized image (if there are any) with a certain color using RGBA color model – "r:(0-255),g:(0-255),b:(0-255);a:(0-255)".

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper resize size:"300 300" color:"r:0,g:128,b:0,a:255"

"r:255,g:255,b:255,a:255" (white)

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper resize size:"800 600" method:neighbour nozoom:yes

Crop (-oper crop)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range which will be cropped.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop pages:1-3

all
method

Select method of image cropping.

Applies a specific image cropping method.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:rect2p

margins, rect2p, rect_pwh, autocrop
left

Set the left margin value.

Sets the left margin size that is used for margins and rect2p cropping methods, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:margins left:10

"0"
top

Set the top margin value.

Sets the top margin that is used for margins and rect2p cropping methods, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:margins top:15

"0"
right

Set the right margin value.

Sets the right margin that is used for margins and rect2p cropping methods, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:margins right:10

"0"
bottom

Set the bottom margin value.

Sets the bottom margin that is used for margins and rect2p cropping methods, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:margins bottom:15

"0"
width

Set width of cropping rectangle for rect_pwh method.

Sets the crop width for the rect_pwh cropping method, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:rect_pwh width:300 height:300

"0"
height

Set height of cropping rectangle for rect_pwh method.

Sets the crop height for rect_pwh cropping method, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:rect_pwh width:200 height:200

"0"
color

Set color sample for the autocrop method.

Applies color code for the autocrop method using RGBA color model – "r:(0-255),g:(0-255),b:(0-255);a:(0-255)".

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:autocrop color:"r:0,g:0,b:0;a:0"

"r:255,g:255,b:255,a:255" (white)
tolerance

Set tolerance value for the autocrop method.

Applies tolerance value for the autocrop method (0-100%). Tolerance parameter specifies the allowed deviation from the color sample specified in the previous color parameter.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper crop method:autocrop tolerance:50

"0"

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper crop method:margins left:100 top:100 right:200 bottom:200

Mirror (-oper mirror)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range which will be mirror-flipped.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper mirror pages:1-3

all
flip

Define the direction of image mirror flipping.

Flips the output image in a selected direction. Available values: vertically, horizontally, or both ways – horizontally and vertically at the same time.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper mirror flip:horizontally

vertically, horizontally, both

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper mirror flip:vertically

Rotate (-oper rotate)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range which will be rotated.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper rotate pages:1-3

all
angle

Define the angle of image rotation.

Rotates the output image to a certain degree (0-360°).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper rotate angle:90

0, 0-360
direction

Select the direction of image rotation: clockwise (CW) or counterclockwise (CCW).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper rotate angle:90 direction:ccw

cw, ccw
color

Set background color for image rotation.

Applies background color around the rotated image (using the RGB color model).

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper rotate angle:45 color:"r:0,g:128,b:0,a:255"

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper rotate angle:45 color:"r:255,g:0,b:255"

Grayscale (-oper grayscale)

To turn on grayscale mode, use this command as an example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper grayscale

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range which will be set to grayscale.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper grayscale pages:"1-3,last"

all

Sharpen (-oper sharpen)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for sharpening filter.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper sharpen radius:10 amount:25 threshold:5 pages:"1,3,5-12"

all
radius

Сontrol the size of the sharpening area for sharpening filter, in pixels.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper sharpen radius:3

5, 0-250
amount

Control how much the contrast should be increased for adjacent pixels.

Sets the number of pixels for the sharpen filter. The amount controls how strong you want the sharpening to be.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper sharpen radius:3 amount:250

100, 1-500
threshold

Control the minimum brightness change that will be sharpened.

Controls the balance between detail and noise. Threshold can be used to sharpen more pronounced edges while leaving subtler edges untouched.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper sharpen radius:3 amount:250 threshold:3

3, 0-255

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper sharpen radius:10 amount:25 threshold:5

Brightness (-oper brightness)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for sharpening filter.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper brightness percent:50 pages:"1,3,5-12"

all
percent

Adjust brightness correction, in percent.

Example:
2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper brightness percent:50

10, -100...100

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper brightness percent:-10

Contrast (-oper contrast)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for contrast correction.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper contrast percent:50 pages:"1,3,5-12"

all
percent

Adjust image contrast correction, in percent.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper contrast percent:10

0
auto

Apply auto contrast adjustment.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper contrast auto:no

yes

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper contrast percent:-10 auto:no

Gamma (-oper gamma)

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for gamma correction.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper contrast percent:50 pages:"1,3,5-12"

all
percent

Adjust image gamma correction, in percent.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper gamma percent:10

1, -100…100

Command line example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper gamma percent:-10

Smoothing noise (-oper smoothingnoise)

To add smoothing that reduces noise, use this command as an example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper smoothingnoise

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for smoothing noise correction.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper smoothingnoise pages:"1,3,5-12"

all

Autolevels (-oper autolevels)

To apply auto-leveling that correct the tonal range and color balance of output images, use this command as an example:

2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper autolevels

ParameterDescriptionValue (values in bold are set by default)
pages

Set page range for the Auto Levels operation.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper autolevels pages:"1,3,5-12"

all

Autorotate (-oper autorotate)

ParameterDescriptionValue (values in bold are set by default)
pages

Set a range of pages that will be autorotated.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\in\*.*" -dst "C:\out" -oper autorotate pages:"1,3,5-12"

all
orientation

Auto-rotate images to portrait or landscape.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper autorotate orientation:landscape

portrait, landscape
direction

Set direction of image auto-rotation: counterclockwise (CCW) or clockwise (CW)

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper autorotate direction:cw

ccw, cw

Command line example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper autorotate pages:1 orientation:landscape direction:cw

Paint (-oper paint)

ParameterDescriptionValue (values in bold are set by default)
pages

Set a range of pages to draw/fill a rectangle on.

Applies to every page by default.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:fillrect pages:"1,3,5-12"

all
cmd

Draw a rectangle on the output image in the form of an outline or a rectangle filled with color.

Adds a rectangle on the image. To choose between an outline or filling with color, use painter commands: drawrect, fillrect

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:fillrect

fillrect, drawrect
rect

Set rectangle position.

Sets the rectangle position on the output image file in the "x0 y0 width height" format, where:

  • x0 – shifts the page position horizontally from the top left corner (0.01 inch);
  • y0 – shifts the page position vertically from the top left corner (0.01 inch);
  • -1, -1 – are the original file's width and height calculated automatically (defaults).

You can keep the default value "0 0 -1 -1" to add a rectangular outline to the JPEG image(s).

Example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect rect:"15 15 -1 -1

"0 0 -1 -1"
pen_color Select pen color (outline color).

Adjusts the outline color of a rectangle. Enter values using the RGBA color model.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect rect:"0 0 100 200" pen_color:"r:255,g:0,b:0,a:255" pen_width:3

"r:0,g:0,b:0,a:255"
brush_color

Select brush color (fill color).

Adjusts the fill color of a rectangle. Enter values using the RGBA color model.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect rect:"0 0 100 200" brush_color:"r:255,g:0,b:0,a:255" pen_width:1

"r:255,g:255,b:255,a:255"
pen_width

Set the thickness of the rectangle's frame.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect rect:"0 0 100 200" pen_color:"r:255,g:0,b:0,a:255" pen_width:3

1
units

Select units for drawing a rectangle: pixels or percents.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect rect:"20 20 20 20" pen_width:30 units:percents

pixels, percents
zorder

Set Z-order for rectangle application.

You can place the rectangle behind (background) or in front (foreground) of the document's contents.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:drawrect zorder:background

foreground, background

Command line example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -oper paint cmd:fillrect pages:"1,3,5-12" pen_width:3 zorder:background

Post processing actions (-postproc)

Using the -postproc switch, you can control what should be done with the original files automatically after processing: do nothing, move or copy to another location, or delete.

ParameterDescriptionValue (values in bold are set by default)
passed

Select action for successfully converted source files.

Performs an action with successfully processed source files: do nothing, copy/move to another folder, or delete.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -postproc passed:delete

none, copy, move, delete
passed_dir

Set path to the destination folder for copy/move action, for converted source files.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -postproc passed:copy passed_dir:"C:\Converted"

Enter folder path
passed_delsf

Delete unused empty subfolders from the source files folder.

Automatically deletes empty subfolders that are no longer needed after the converted files are moved or deleted by a post-processing action.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options scansf:yes -postproc passed:move passed_dir:"C:\Done" passed_delsf:yes

no, yes
failed

Select action for source files that failed to convert.

Performs a specific action with source files that were not converted for some reason.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -postproc failed:move failed_dir:"C:\Unable to convert"

none, copy, move, delete
failed_dir

Set path to the destination folder for copy/move action, for failed source files.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -postproc failed:move failed_dir:"C:\Unable to convert"

Enter folder path
failed_delsf

Delete unused empty subfolders from the source files folder.

Automatically deletes empty subfolders that are no longer needed after the failed files are moved or deleted by a post-processing action.

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options scansf:yes -postproc passed:move failed_dir:"C:\Unable to convert" failed_delsf:yes

no, yes
output

Select action for output JPEG files: keep, delete or delete all.

  • keep – keep all output files
  • delete – delete failed files only
  • delete_all – delete all files if at least one failed

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -postproc output:delete

keep, delete, delete_all

Command line example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -options scansf:yes -postproc passed:move passed_dir:"C:\Done"

File loading settings (-fls)

Excel (-fls excel)

To define page scaling of Excel sheets, use this command as an example:

2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -fls excel esm:fit

ParameterDescriptionValue (values in bold are set by default)
esm

Set Excel export scale mode.

Available options:

  • Original – keeps the original size of Excel sheets
  • Fit – scales small pages up and shrinks large pages down to fit the output file format

Example:
2jpeg.exe -src "C:\In\*.*" -dst "C:\Out" -fls excel esm:fit

original, fit

Info (-info)

To find out the number of pages is a specific document, use this command as an example:

2jpeg.exe -src "C:\In\Text.pdf" -info pagecount

ParameterDescriptionValue (values in bold are set by default)
pagecount

Get the number of pages of a file as executable's exit code.

Generates a return code with the number of pages contained in the document. For example, Page count=5.

Example:
2jpeg.exe -src "C:\In\Text.pdf" -info pagecount

-

2JPEG Settings

If you don't need to define new settings in the command line each time, take a look at the default settings of the program. They are available in the 2JPEG Settings editor with GUI controls. To access it, use this command:

2jpeg.exe -ini

These settings are the default settings of the program and are applied to all the files, so you can set up everything only once, and they will be used every time you run 2JPEG.

Please change them with caution. If you're not sure about a specific setting, contact our support for assistance beforehand.

Note: settings applied via the command line syntax will override the default 2JPEG Settings.

2JPEG Settings - default settings

Combine or change the command line switches, parameters and values as you see fit – they don't require a strict order. Thanks to the command line syntax, 2JPEG can be very adaptive to your needs, making processing of multiple files fast and efficient. If you have trouble creating commands for 2JPEG, please contact us.