Classes
Main classes in the Perfectly Clear .NET API.
This page documents the main classes in the Perfectly Clear .NET API.
PerfectlyClear
The primary class for applying Perfectly Clear image corrections, implementing IDisposable for proper resource management.
public unsafe class PerfectlyClear : IDisposableConstructors
These constructors create instances of the PerfectlyClear class with different initialization options.
PerfectlyClear default constructor
Creates an instance for multi-threaded scenarios where SetProtectionPath has already been called.
public PerfectlyClear()PerfectlyClear with license path
Creates an instance with license validation in a single-threaded scenario.
public PerfectlyClear(string path, string licenseCode = "")Properties
These properties provide access to correction parameters and operation status.
m_Param
Exposes the current correction parameters structure for direct modification.
public PFCPARAM m_Param;LastStatus
Contains the detailed status information from the most recent Calc or Apply operation.
public PFCSTATUS LastStatus;Static methods
These methods configure shared resources and should be called before creating instances in multi-threaded applications.
SetProtectionPath
Initializes the license system for multi-threaded usage before creating PerfectlyClear instances.
public static int SetProtectionPath(string path, string licenseCode)ReleaseProtectionPath
Releases license resources when all processing is complete.
public static void ReleaseProtectionPath()SetAddonPath
Specifies the directory containing .looks files for Creative LOOKs Filters.
public static void SetAddonPath(string dirPath)Methods
These instance methods perform image analysis, correction, and configuration.
SetParam
Initializes the m_Param structure with optimized values from a built-in preset.
public void SetParam(PFCPRESETID id)ReadPresets
Loads correction parameters from a .preset file exported from Perfectly Clear applications.
public int ReadPresets(string path)Returns: 0 on success, negative on error.
Calc
Analyzes an image and calculates correction profiles for subsequent Apply operations.
public ADPTRRETURNCODE Calc(ref Bitmap bm)
public ADPTRRETURNCODE Calc(ref PFCImageFile imgfile)
public ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds)
public ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature)
public ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature)
public ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature)
public ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption)
public ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption)
public ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature, int ISO, string CameraModel)Apply
Applies corrections to an image using the previously calculated profile.
public PFCAPPLYSTATUS Apply(ref Bitmap bm)
public PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile)
public PFCAPPLYSTATUS Apply(ref Bitmap bm, int iOpacity)
public PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile, int iOpacity)AutoCorrect
Performs complete image correction by combining Calc and Apply in a single convenient call.
public int AutoCorrect(ref Bitmap bm)
public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds)
public int AutoCorrect(ref Bitmap bm, int ISO, string CameraModel, bool bFastFAE)
public int AutoCorrect(ref PFCImageFile imgfile, int ISO, string CameraModel, bool bFastFAE)
public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, int ISO, string CameraModel, bool bFastFAE)
public int AutoCorrect(ref Bitmap bm, string pathPreset)
public int AutoCorrect(ref PFCImageFile imgfile)
public int AutoCorrect(ref PFCImageFile imgfile, string pathPreset)
public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset)
public int AutoCorrect(ref Bitmap bm, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
public int AutoCorrect(ref PFCImageFile imgfile, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset, int ISO, string CameraModel, bool bFastFAE)ReadPresetsFromStream
Loads correction parameters from a .preset stream.
public int ReadPresetsFromStream(FileStream fs)LoadAiEngine
Loads AI model files to enable AI-powered correction features.
public int LoadAiEngine(PFCAIFEATURE aifeatures, string binPath)Example:
int loaded = pfc.LoadAiEngine(
PFCAIFEATURE.AI_SCENE_DETECTION | PFCAIFEATURE.AI_CORRECTIONS,
"path/to/models");LoadScenePresets
Loads scene-optimized presets from file, with optional model compatibility checks.
public int LoadScenePresets(string filePath, int groupUUID = 0, int* arrProfileUUID = null, int arrProfileUUIDLen = 0)LoadScenePresetsFromStream
Loads scene-optimized presets from a stream.
public int LoadScenePresetsFromStream(FileStream fs, int groupUUID = 0, int* arrProfileUUID = null, int arrProfileUUIDLen = 0)ReadScenePreset
Fills parameters for a detected scene from preloaded scene presets.
public int ReadScenePreset(ref PFCPARAM param, int scene)GetScene
Returns the scene label detected in the most recent analysis.
public int GetScene(int* version)GetCategorizationEngineInfo
Returns categorization model UUID information from the loaded AI engine.
public bool GetCategorizationEngineInfo(int* groupUUID, int* arrProfileUUID, int* arrProfileUUIDLen)GetSceneDescription
Returns scene metadata for a scene index.
public bool GetSceneDescription(int index, ref PFCSCENEDESCRIPTION sceneDescription)ApplyStrengthToParam
Scales all correction parameters by a global strength multiplier.
public void ApplyStrengthToParam(int strength)AbnormalTintDetected
Reports whether abnormal tint was detected for a specified tint mode.
public bool AbnormalTintDetected(TINTCORRECTION eTintMethod)HasFaceBeautification
Determines whether Face Beautification is available in the current configuration.
public bool HasFaceBeautification()FBFaceCount
Returns the count of faces detected during Face Beautification analysis.
public int FBFaceCount()FAEFaceCount
Returns the number of faces recognized by Face Aware Exposure.
public int FAEFaceCount()GetFaceInfo
Retrieves detailed geometry information for a specific detected face.
public bool GetFaceInfo(ref PFCFBFACEINFO info, int index)EnumFAEFaceRect
Iterates over FAE face rectangles in the current profile.
public bool EnumFAEFaceRect(ref PFCFACERECT rect)SetSingleThreadedEngine
Forces single-threaded or multi-threaded processing mode.
public bool SetSingleThreadedEngine(bool bSingleThreaded)ReadImage
Loads an image file into a Bitmap object for processing.
public Bitmap ReadImage(string filename)Dispose
Releases all resources associated with the PerfectlyClear instance.
public void Dispose()PFCImageFile
Provides advanced file handling with EXIF metadata preservation and color space conversion support.
public unsafe class PFCImageFile : IDisposablePFCImageFile Constructors
public PFCImageFile()PFCImageFile Methods
These methods handle image file loading and saving with metadata support.
LoadImage
Loads an image from file with optional color space conversion to sRGB.
public PFC_FILE_LOAD_STATUS LoadImage(string filename, bool bConvertToSRGB, string iccFolderPath)
public PFC_FILE_LOAD_STATUS LoadImage(string filename, PFC_FILETYPE type, bool bConvertToSRGB, string iccFolderPath)ExpandImageBuffer
Loads image data from a MemoryStream.
public PFC_FILE_LOAD_STATUS ExpandImageBuffer(MemoryStream inStream, PFC_FILETYPE type, bool bConvertToSRGB = true, string iccFolderPath = null)SaveImageFile
Saves the image to file with configurable quality, color space, and metadata options.
public bool SaveImageFile(string filename, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata)
public bool SaveImageFile(string filename, PFC_FILETYPE type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata)CompressImageBuffer
Writes image data to a compressed output MemoryStream.
public MemoryStream CompressImageBuffer(PFC_FILETYPE type, int jpegQuality = 92, bool bConvertToOriginalColorSpace = true, bool bEmbedOriginalMetadata = true)Buffer and metadata accessors
public void AllocBuffer(int width, int height, int bytes_per_pixel, int stride)
public int pfcImageFormat()
public int exifOrientation()
public byte* raw_image()
public int width()
public int height()
public int bytes_per_pixel()
public int stride()
public bool sourceSRGB()PFCImageFile Properties
These properties expose image metadata and dimensions.
| Property | Type | Description |
|---|---|---|
| width | int | Image width |
| height | int | Image height |
| stride | int | Bytes per row |
| bytes_per_pixel | int | Bytes per pixel |
| pfcImageFormat | int | Pixel format |
| exifOrientation | int | EXIF orientation |
| sourceSRGB | bool | Whether source image was tagged as sRGB |
Core .NET types
These public structs and enums are used by the .NET wrapper for geometry, scene metadata, LUT configuration, and gradient masks.
PFCPOINT
Defines a 2D point.
| Field | Type | Description |
|---|---|---|
| x | int | X coordinate |
| y | int | Y coordinate |
PFCRECT
Defines a rectangle.
| Field | Type | Description |
|---|---|---|
| left | int | Left coordinate |
| top | int | Top coordinate |
| width | int | Rectangle width |
| height | int | Rectangle height |
PFCCORE_MASK_TYPE
Defines mask types for gradient filtering.
| Value | Description |
|---|---|
PFCCORE_MASK_NONE | 0.0 everywhere, do not apply |
PFCCORE_MASK_ALL | 1.0 everywhere |
PFCCORE_MASK_RADIAL | Ellipse mask |
PFCCORE_MASK_TOP | Linear gradient from top |
PFCCORE_MASK_BOTTOM | Linear gradient from bottom |
PFCCORE_MASK_ROUNDRECT | Rounded rectangle |
PFC3DLutInfo
Describes a 3D LUT reference and strength.
| Field | Type | Description |
|---|---|---|
| guid | string | LUT GUID (32 chars + null terminator in native layout) |
| strength | byte | LUT strength from 0 to 100 |
PFCSCENEDESCRIPTION
Describes a detected scene.
| Field | Type | Description |
|---|---|---|
| name | string | UTF-8 scene name |
| profileUUID | int | Scene profile UUID |
PerfectlyClearImageTransfer
Internal transfer structure used by the wrapper to describe channel layout when marshaling bitmap image buffers.
| Field | Type | Description |
|---|---|---|
| width | int | Pixel width |
| height | int | Pixel height |
| rowBytes | int | Bytes per scanline |
| columnBytes | int | Bytes per pixel |
| data1 | int | Red channel location |
| data2 | int | Green channel location |
| data3 | int | Blue channel location |
PFC-SDK Version 10.7.3.1317 built from df9dbc8727c92fb9b1d2c68b21e60ea9c7229e1a on 03-23-2026.
Copyright © 2026 EyeQ Imaging Inc. All rights reserved.