Perfectly Clear SDK Documentation  9.0.0.295
Command Line Application
Perfectly Clear Command Line Application
Perfectly Clear Command Line Application

This command line application called pfccmd is the quickest way to integrate the Perfectly Clear technology into your photo workflow. The application was built using this SDK, and offers all of the image corrections of the full SDK, along with easy-to-use parameters that allow it to adapt to a wide range of uses.

Table of Contents

  1. Description
  2. Usage
  3. SDK License Protection
  4. About Resizing Parameters
  5. Status & Exit Codes
  6. JSON Output Report
  7. Example Usage

Description

The pfccmd command line application operates either on a single image file, or on a list of images or directory. Every supported image found in the input directories will be processed. When multiple files are being processed, the output filenames will be the based on the input filename, but will end with "_perfectlyclear" (IMG_1234.jpg becomes IMG_1234_perfectlyclear.jpg).

Usage

Usage: pfccmd [options ...] [paths] ...

The following options influence how the pfccmd application operates:

paths to processA list of files or folders to process.
-h, --helpShow usage help and exit
-s, --sdk-license PATHPath to sdk_license folder provided by EyeQ. If you are provided a SDK license and do not set it here, then the pfccmd command line application will not apply corrections to your photos.
-p, --preset PATHPath to .preset file wtih correction parameters to apply. If this option is omitted, then the default iAuto corrections will apply. Also accepts: auto and none.
-o, --output-path PATHPath to write the output file to. If a single input file is provided, then PATH is the full path and filename for the output file - and a file type extention is required. Otherwise, PATH will used as the output directory where output files are written.
-q, --output-quality INTCompression quality to use when creating lossy compressed output files (JPEG or WEBP), limited to the range [40-100].
--stdioRead file from stdin and write the output to stdout. Type should be suplied with input-type and output-type
--input-type TEXTSets the input filetype when using stdio processing. Defaults to JPEG.
--output-type TEXTUsed for stdio mode. Defaults to the same as input type.
-m, --scale-mode TEXTResize the image using: none, width, height, long, short, scale.
-v, --scale-value INTResize image to this size. Units are in pixels for all modes other than scale which is in integer percentage: 200 = 200% = double height and double width of the image. This option is required when using --scale-mode.
--skip TEXTControls the digital photograph detection mechanism. Options are clipart (default), legacy, none. 'Clipart' uses AI to detect non-photographic images, 'legacy' uses the same mechanism as the v8 SDK, and 'none' will attempt to process every image regardless of image content. Skipping a file will result in 'Success' exit code and a status message indicating it was skipped.
-f, --fast-faeEnable the 'Fast Face Aware Exposure' processing mode. The default is to use 'High Quality Face Aware Exposure' to provide the best face detection.
-j, --jsonEnable image attribute report in JSON format.
--profile-onlyDo not create an output image - useful when used with --json.

SDK License Protection

You will be provided with a "sdk_license" folder when you receive this application. It contains a unique license key indentifier and will be actived online once every 12 to 24 hours.

The path to this folder must be set with either the --sdk-license option or the PFC_SDK_LICENSE environment varaible. If both are present, then the --sdk-license takes priority.

The pfccmd needs read and write permission to this folder. If the path does not exist or cannot be read or written, the pfcmd application will return an error and your images will not be corrected.

About Resizing Parameters

When resizing, only one parameter is used even if multiple parameters are provided. Non-integer paramerer are ignored. The order of priority is:

  1. width
  2. height
  3. long
  4. short
  5. scale

Width and Height will set the output size to have either the specified width or height - which ever is specified. The other dimension will be automatically determined to maintain the same aspect ratio as the original image.

Long and Short will set the output size based on the long or short side - which ever is specified. The other dimension will be automatically determined to maintain the same aspect ratio as the original image.

When using the scale parameter, the value should be an integer represenation of the percent scale you would like to apply. For example, scale=50 would be a 50% scale, or half the width and half the height of the original image.

Status & Error Codes

A status will be reported for the overall operation, and then a status will be reported for each image that is processed. The Status Message will be displayed, and the corresponding exit code will be returned.

Job-Based Status and Exit Codes

Ok = 0Success. License was activated, preset loaded and all passed images returned OK.
LicenseError = 1License could not be authenticated. Images were not corrected.
PresetError = 2Couldn't parse the preset given. Images were not corrected.
ArgumentsError = 3Some of the arguments given are not correct. Also includes a message with further details on the error.
ImageError = 4At least one of the given images has errors.

Per-image Status Messages

OkSuccess: image was processed and written successfully.
LoadErrorImage could not be loaded.
CorrectionErrorCorrections could not be applied.
ResizeErrorError occured during resizing.
SaveErrorError writing the output image.

JSON output

When using the --json option, a report will be generated in JSON format that includes Job-based Status as well as an element for each image processed. For example:

{
  "images": [
    {
      "allFacesRect": {
        "height": 1148,
        "left": 169,
        "top": 303,
        "width": 2332
      },
      "faces": [
        {
          "height": 881,
          "left": 169,
          "top": 570,
          "width": 881
        },
        {
          "height": 516,
          "left": 1985,
          "top": 605,
          "width": 516
        },
        {
          "height": 418,
          "left": 1201,
          "top": 303,
          "width": 418
        }
      ],
      "facesCount": 3,
      "input": "img_1234.jpg",
      "output": "img_1234_perfectlyclear.jpg",
      "status": "ok"
    },
    {
      "allFacesRect": {
        "height": 573,
        "left": 910,
        "top": 495,
        "width": 573
      },
      "faces": [
        {
          "height": 573,
          "left": 910,
          "top": 495,
          "width": 573
        }
      ],
      "facesCount": 1,
      "input": "img_2345.jpg",
      "output": "img_2345_perfectlyclear.jpg",
      "status": "ok"
    }
  ],
  "message": "",
  "status": "ok"
}

Example Usage

The some common ways to call this application include:

1. Applies default correction parameters to input.jpg and writes result to input_pfccmd.jpg

pfccmd input.jpg

2. Applies default correction parameters to input.png, and writes result to output.jpg - changing filetype to JPEG

pfccmd input.png -o output.jpg

3. Applies default correction parameters to input.png, and writes result to input_perfectlyclear.jpg - changing filetype to JPEG

pfccmd --output-type jpg input.png

4. Applies custom correction parameters to input.jpg, and writes result to output.jpg

pfccmd input.jpg -o output.jpg -p path/to/correction.preset

5. Corrects every image in the 'input' directory and writes output files to 'output' directory

pfccmd input -o output

6. Corrects and resized to 1000 pixels on the longer side

pfccmd -m long -v 1000 input.jpg

7. Use Standard input and output, defaulting to JPEG input and output

pfccmd < in.jpg > out.jpg

8. Use Standard input and output, and setting input and output formats/p>

pfccmd  --input-type png --output-type jpg < ../some/path/in.png > output/path/out.jpg