PhotoSanitize Command-Line Options and Exit Codes

PhotoSanitize Command-Line Options and Exit Codes

The Enterprise command-line interface provides two image-processing commands, analyze and sanitize, with additional options for controlling output behavior.

The general syntax for analysis is:

PhotoSanitize.exe --cli analyze <file-or-folder> [additional-inputs] [--json]

For sanitization:

PhotoSanitize.exe --cli sanitize <file-or-folder> [additional-inputs] [options]

Replace the input placeholder with one or more file or directory paths. Paths containing spaces should be enclosed in quotation marks.

You can display the available command-line help using PhotoSanitize.exe --help or check the application version with PhotoSanitize.exe --version.

Sanitization profile

The --profile option selects the cleanup profile. Accepted values are metadata, standard, and rebuild.

For example:

PhotoSanitize.exe --cli sanitize "C:\Photos\Image.jpg" --profile rebuild

Standard is used if no profile is specified. Maximum Privacy and Custom are not supported in command-line processing.

Output directory and format

Use --output to choose a destination directory:

PhotoSanitize.exe --cli sanitize "C:\Photos" --output "D:\CleanPhotos"

Without this option, PhotoSanitize uses its normal default output behavior.

Use --format to request an output format. The accepted values are same, jpeg, png, webp, tiff, bmp, and gif.

For example:

PhotoSanitize.exe --cli sanitize "C:\Photos\Image.jpg" --format png

The default value, same, retains the original format when supported. HEIC, HEIF, and AVIF images normally produce PNG outputs under this setting.

Format selection remains subject to compatibility. An image that requires a particular representation or frame-handling capability may not support every requested output format.

Filename suffix

The --suffix option replaces the default _sanitized suffix with another valid filename suffix.

For example:

PhotoSanitize.exe --cli sanitize "C:\Photos\Image.jpg" --suffix "_public"

The suffix cannot contain characters that Windows prohibits in filenames. Existing output files are protected through collision-safe naming.

JPEG and WebP quality

Use --jpeg-quality with an integer from 1 to 100 to select the quality value for applicable JPEG or WebP encoding.

For example:

PhotoSanitize.exe --cli sanitize "C:\Photos\Image.jpg" --format jpeg --jpeg-quality 95

The default value is 92.

The quality setting does not apply to every output format or guarantee lossless encoding. If the selected operation preserves the existing encoded picture without recompression, it may have no effect on that image.

Frame handling

The --frames option accepts preserve or first.

Use preserve when you want PhotoSanitize to retain supported animation frames or multipage content:

PhotoSanitize.exe --cli sanitize "C:\Photos\Animation.gif" --profile rebuild --frames preserve --format gif

Use first when the intended output is based on the first frame.

Frame preservation depends on the source and output capabilities. Do not assume that every animation format can be converted to every other format while retaining its frames and timing.

Folder structure

When a custom output directory is specified, PhotoSanitize preserves the relative source folder structure by default.

Use --no-preserve-structure if you want the outputs placed without that relative directory arrangement.

This can be convenient when collecting results into a single directory, but you should pay attention to filenames if several source folders contain images with identical names.

PhotoSanitize avoids unintended overwriting, but multiple similarly named results can still become difficult to distinguish without a clear naming policy.

Verification

Verification is enabled by default for command-line sanitization.

The --no-verify option disables the post-sanitization verification stage.

This may be useful for a specific workflow that performs its own later checks, but it also means PhotoSanitize does not provide the normal automatic verification result for that command.

For personal privacy, professional delivery, or organizational processing, retaining verification is generally preferable.

JSON output

The --json option requests structured results for either analysis or sanitization.

For example:

PhotoSanitize.exe --cli sanitize "C:\Photos\Incoming" --profile standard --json

This format is intended for software integration. It provides information that scripts can read without relying on the appearance of the normal console output.

The exact result fields depend on the command and whether individual files completed successfully.

Exit codes

CodeMeaning
0The command completed successfully
2Invalid command syntax or options
3Input expansion, missing supported images, or analysis failure
4Sanitization or image-processing failure
5Enterprise licensing requirement or verification failure
70Application or command-line startup failure
78Unsupported Windows runtime environment
130Operation canceled

An operation involving several files can return a nonzero exit code when one or more images fail, even though other files were processed successfully. Check the individual results before deciding which outputs are ready to use.

Complete examples

To analyze a directory and receive JSON results:

PhotoSanitize.exe --cli analyze "C:\Work\Incoming" --json

To remove supported metadata from a single image:

PhotoSanitize.exe --cli sanitize "C:\Work\Photo.jpg" --profile metadata

To sanitize a directory using the Standard profile and write PNG outputs to another location:

PhotoSanitize.exe --cli sanitize "C:\Work\Incoming" --profile standard --format png --output "C:\Work\Processed"

To reconstruct images using a custom filename suffix:

PhotoSanitize.exe --cli sanitize "C:\Work\Incoming" --profile rebuild --suffix "_reconstructed" --output "C:\Work\Rebuilt"

To produce a still PNG from the first frame of an animation:

PhotoSanitize.exe --cli sanitize "C:\Work\Animation.gif" --profile rebuild --frames first --format png

For scripts used in production, explicitly choose the required profile and output location rather than depending on assumptions about defaults. Keep the original files available until the resulting images have been checked and any required records have been retained.