Using the CLI
How to configure and use the Perfectly Clear command-line tools
This reference covers all available options, batch processing patterns, and preset usage for the pfccmd and pfcaiserver command-line applications.
About the AI server
The AI server (pfcaiserver) is an optional component that can improve performance when processing large batches of images with AI tools. By keeping AI models loaded in memory, it reduces the overhead of loading models for each image processed by pfccmd.
When using the AI server, pfccmd sends image data to the server for scene detection and other AI inference tasks, and the server returns the detected information to pfccmd. This allows pfccmd to focus on image correction while leveraging the server's optimized AI processing. Both CLIs can run on the same machine or on separate machines within a network. The long-running pfcaiserver loads the various AI models once and serves multiple requests from pfccmd clients.
To use it, just run pfcaiserver on the same instance or local network as pfccmd and have pfccmd connect to it as shown below.
Command syntax
The basic syntax for pfccmd is:
pfccmd [options] [paths]Where [paths] is one or more files or directories to process. When processing multiple files or a directory, output filenames are based on input filenames with a _perfectlyclear suffix added.
Options reference
The following tables list all available command-line options, organized by category.
General options
These options control basic input/output behavior and help.
| Option | Description |
|---|---|
-h, --help | Show usage help and exit |
-s, --sdk-license PATH | Path to sdk_license folder provided by EyeQ |
-p, --preset PATH | Path to .preset file with correction parameters, or keywords: scene, auto, none |
-o, --output-path PATH | Output file path (single file) or output directory (batch mode) |
-q, --output-quality INT | Compression quality for JPEG/WebP output (40-100) |
-j, --json | Output image attribute report in JSON format |
--profile-only | Analyze image without creating output file (use with --json) |
Stdio options
These options enable reading from standard input and writing to standard output, useful for piping images through other commands.
| Option | Description |
|---|---|
--stdio | Read from stdin and write to stdout |
--input-type TEXT | Input file type for stdio mode (default: JPEG) |
--output-type TEXT | Output file type for stdio mode (default: same as input) |
Resize options
These options control output image dimensions.
| Option | Description |
|---|---|
-m, --scale-mode TEXT | Resize mode: none, width, height, long, short, scale |
-v, --scale-value INT | Target size in pixels, or percentage for scale mode |
When multiple resize parameters are provided, only one is used based on priority order: width → height → long → short → scale.
Processing options
These options control how images are analyzed and corrected.
| Option | Description |
|---|---|
-f, --fast-fae | Use fast face detection instead of high-quality mode |
--skip TEXT | Clipart detection mode: clipart (default), legacy, none. This option is ignored when using AI Scene Detection |
--skip-exif-software TEXT | Skip images edited by specified software (comma-separated) |
--red-eye TEXT | Red eye correction mode: always, preset, no-flash (default), flash, off . See the table below for details |
--output-color-space TEXT | Output color space: original (default), sRGB, or path to ICC profile |
--enable-composite TEXT | Enable composite photo extraction: true (default), false |
--log-pdf-images | Log images extracted from PDF files |
Red eye correction modes
| Mode | Description |
|---|---|
always | Apply red eye correction to all detected faces regardless of flash or preset settings |
preset | Apply red eye correction based on preset settings (default behavior) |
no-flash | Require the preset to include Red Eye correction, but disable if EXIF data shows the flash was not fired. Red Eye will be applied to images without any EXIF data. |
flash | Require the preset to include Red Eye correction, and also require EXIF data to show the flash was fired. Red Eye will NOT be applied to images without any EXIF data. |
off | Disable red eye correction entirely |
Scene detection options
These options control AI Scene Detection behavior.
| Option | Description |
|---|---|
--scene-detection TEXT | Enable or disable scene detection: on, off |
--scene-detection-server TEXT | URL for remote AI server (e.g., tcp://127.0.0.1:29170) |
--scene-model-path PATH | Path to directory containing .pnn model files |
--list-local-scenes | List available scene detection labels and exit |
--ssl-certs-path TEXT | Path to SSL certificates for HTTPS connections (Linux only when using SSL-protected scene detection server) |
Auto crop options
These options configure automatic face-based cropping for portrait photography. Workbench will export the exact command line arguments and their values from its [Auto Crop tool] (/docs/general-info/presets).
| Option | Description |
|---|---|
--autocrop TEXT | Enable auto cropping: true, false (default) |
--autocrop_size TEXT | Head size factor (default: 3) |
--autocrop_x TEXT | Horizontal offset from center (default: 0) |
--autocrop_y TEXT | Vertical offset from center (default: 0) |
--autocrop_topheadgap TEXT | Gap above head relative to image |
--crop_arw TEXT | Aspect ratio width (default: 4) |
--crop_arh TEXT | Aspect ratio height (default: 5) |
Batch file option
Process a list of images with per-image preset assignments.
| Option | Description |
|---|---|
--image-list-file PATH | Path to text file listing images and presets to apply |
The list file format is one image per line, with the image path followed by a space and the preset path:
/images/img_1234.jpg /presets/corrections.preset
/images/img_1235.png /presets/other.preset
"/path/with spaces/image.jpg" "/presets/my preset.preset"Images in the list file are overwritten with the corrected output.
SDK license protection
For protected SDK builds, you must provide the path to your sdk_license folder. This folder contains your unique license key identifier and is validated online every 12 to 24 hours.
Set the license path using either method:
# Using command-line option
pfccmd -s /path/to/sdk_license input.jpg -o output.jpg
# Using environment variable
export PFC_SDK_LICENSE=/path/to/sdk_license
pfccmd input.jpg -o output.jpgIf both are set, then the -s command-line option takes priority.
The pfccmd application needs read and write permission to the sdk_license folder. If the path doesn't exist or can't be accessed, then images are not corrected.
Batch examples
The CLI supports several batch processing patterns for high-volume workflows.
Process a directory
Process all supported images in a directory:
pfccmd ./input -o ./outputOutput files are named based on input files with _perfectlyclear appended before the extension.
Process with custom preset
Apply a specific preset to all images:
pfccmd ./input -o ./output -p /path/to/corrections.presetProcess with resize
Correct and resize all images to 1000 pixels on the long edge:
pfccmd ./input -o ./output -m long -v 1000Process with quality setting
Set JPEG output quality to 85:
pfccmd ./input -o ./output -q 85Skip previously edited images
Skip images that were already processed in Photoshop or Lightroom:
pfccmd ./input -o ./output --skip-exif-software "photoshop,lightroom"The software names are matched case-insensitively against the EXIF Software (0x0131) and Processing Software (0x000b) tags.
When using --skip-exif-software, resizing is still applied and the image is re-encoded, but no color or exposure corrections are applied.
Process using list file
For complex workflows where different images need different presets, use a list file:
pfccmd --image-list-file /path/to/jobs.txtWhere jobs.txt contains:
/photos/portrait1.jpg /presets/portrait.preset
/photos/landscape1.jpg /presets/landscape.preset
/photos/product1.jpg /presets/product.presetUsing presets
Presets define the correction parameters applied to images. You can use the built-in AI Scene Detection or apply custom presets exported from Perfectly Clear Workbench.
AI scene detection
By default, pfccmd uses AI Scene Detection to automatically select optimal corrections based on image content. This is equivalent to:
pfccmd input.jpg -p sceneOr:
pfccmd input.jpg -p autoCustom presets
To use your own correction settings, export these from Perfectly Clear Workbench.
pfccmd input.jpg -o output.jpg -p /path/to/my_corrections.presetAI presets with scene detection
You can also export an AI Presets group from Workbench that contains custom presets for each scene type. When you pass this file to pfccmd, Scene Detection is enabled and your custom presets are applied based on detected scene:
pfccmd input.jpg -o output.jpg -p /path/to/AI_Presets.presetNo corrections
To resize or convert an image without applying any corrections:
pfccmd input.jpg -o output.jpg -p none -m long -v 1200Converting formats
The CLI supports format conversion between JPEG, PNG, and WebP.
Convert by output extension
The simplest method is to specify a different extension in the output filename:
# PNG to JPEG
pfccmd input.png -o output.jpg
# JPEG to PNG
pfccmd input.jpg -o output.pngConvert using output-type flag
When processing directories or using stdio mode, use the --output-type flag:
pfccmd --output-type jpg input.pngThis creates input_perfectlyclear.jpg regardless of the input format.
Set output quality
For lossy formats (JPEG, WebP), control quality with -q:
pfccmd input.png -o output.jpg -q 95Quality ranges from 40 (smallest file, lowest quality) to 100 (largest file, highest quality). The default is 90.
Convert color space
By default, the CLI preserves the original color profile of the input image. You can override this with the --output-color-space option, which is useful to convert all images you process to a specific color space.
Convert output to sRGB:
pfccmd input.jpg -o output.jpg --output-color-space sRGBConvert to a custom ICC profile:
pfccmd input.jpg -o output.jpg --output-color-space /path/to/profile.iccKeep the original color profile (default behavior):
pfccmd input.jpg -o output.jpg --output-color-space originalStdio mode
For integration with pipelines, read from stdin and write to stdout:
pfccmd --stdio < input.jpg > output.jpgSpecify input and output formats explicitly:
pfccmd --stdio --input-type png --output-type jpg < input.png > output.jpgEnvironment variables
These environment variables configure pfccmd behavior without command-line options.
| Variable | Description |
|---|---|
PFC_SDK_LICENSE | Path to the sdk_license folder |
PFC_SD_SERVER | URL to the pfcaiserver (e.g., tcp://127.0.0.1:29170) |
PFC_SINGLE_THREAD | Set to true to force single-threaded processing |
PFC_ENABLE_COMPOSITE | Set to true or false to enable/disable composite extraction. Composite extraction is an optional feature that may not be supported in your CLI package |
Status and exit codes
The CLI returns exit codes to indicate success or failure, useful for scripting and automation.
Job-level exit codes
Understand what each exit code means:
| Code | Status | Description |
|---|---|---|
| 0 | Ok | All images processed successfully |
| 1 | LicenseError | License could not be authenticated |
| 2 | PresetError | Preset file could not be parsed |
| 3 | ArgumentsError | Invalid command-line arguments |
| 4 | ImageError | One or more images had errors |
Per-image status messages
When using --json, each image includes a status field:
| Status | Description |
|---|---|
| Ok | Image processed and saved successfully |
| LoadError | Image could not be loaded |
| CorrectionError | Corrections could not be applied |
| ResizeError | Error during resizing |
| SaveError | Error writing output file |
| CategorizationError | Error during scene detection |
JSON output
The --json flag outputs detailed information about each processed image. This example shows the structure:
{
"images": [
{
"input": "/path/to/input.jpg",
"output": "/path/to/output.jpg",
"status": "ok",
"message": "",
"width": 2380,
"height": 3597,
"format": 1,
"scene": 5,
"noise": "unknown",
"facesCount": 1,
"faces": [
{
"left": 604,
"top": 302,
"width": 384,
"height": 384,
"confidence": 100,
"angle": 1,
"smile": 26,
"blink": 0
}
]
}
],
"status": "ok",
"message": ""
}The scene value indicates the detected scene category. Use --list-local-scenes to see available scene labels and their numeric IDs.
Optimize for speed with AI server
For workflows that process many individual images, the AI server (pfcaiserver) improves performance by keeping AI models loaded in memory. This can save up to 30% of processing time per image when using AI Scene Detection and other AI tools.
Start the server
Run pfcaiserver on the same machine or local network as pfccmd:
pfcaiserverBy default, it listens on 127.0.0.1:29170 using TCP.
Configure the server
| Option | Description |
|---|---|
-s, --sdk-license PATH | Path to sdk_license folder |
--model PATH | Path to .pnn files for all AI tools |
--http | Use HTTP instead of TCP |
--address IP:PORT | IP address and port number to listen on. Defautls are 127.0.0.1 and 29170 for TCP and 80 for HTTP. |
Example with HTTP on port 8080:
pfcaiserver --http --address 129.168.1.123:8080Connect pfccmd to the server
Tell pfccmd to use the running server:
pfccmd --scene-detection-server tcp://127.0.0.1:29170 input.jpg -o output.jpgOr set the environment variable:
export PFC_SD_SERVER=tcp://127.0.0.1:29170
pfccmd input.jpg -o output.jpgFor HTTP connections on a remote server:
pfccmd --scene-detection-server http://129.168.1.123:8080 input.jpg -o output.jpgCLI Version 10.7.2.1269 built from 4fa849d8101945eea725a08dd0dae5101f090fa0 on 11-10-2025.
Copyright © 2026 EyeQ Imaging Inc. All rights reserved.