EyeQ Docs
Getting started

.NET/C# Quickstart

Getting started with Perfectly Clear SDK in .NET/C#

This guide walks you through correcting your first image using the Perfectly Clear SDK in .NET. The .NET SDK files bundle is only available for Windows.

Prerequisites

Before you begin, ensure that you have:

  • Windows operating system (x64)
  • .NET 8 SDK installed on your PC.

Verify your installation by running dotnet --version in your terminal.

Project structure

Set up your project directory with the SDK extracted alongside your source files:

my-project/
├── Program.cs
├── quick-dotnet.csproj
└── perfectly-clear-sdk/
    ├── Win/
    │   └── bin/
    │       └── x64/
    │           ├── PerfectlyClearAdapter.dll
    │           ├── PerfectlyClearPro.dll
    │           ├── PFCImageFile.dll
    │           ├── exiv2.dll
    │           └── v3.looks
    └── sdk_license/
        └── (license files)

Activate the SDK license

Create a PerfectlyClear instance with the path to your license files. The constructor activates the license automatically.

using PerfectlyClearAdapter;

string exePath = AppDomain.CurrentDomain.BaseDirectory;
string licensePath = Path.Combine(exePath, "sdk_license");

PerfectlyClear pfc = new PerfectlyClear(licensePath);
if (pfc == null)
{
    Console.WriteLine("License activation failed");
    return;
}
Console.WriteLine("SDK license activated successfully");

The license files are copied to the output directory during build, so use AppDomain.CurrentDomain.BaseDirectory to locate them relative to the executable.

Load an image

Use PFCImageFile to load an image from disk. The second parameter (true) converts the image to sRGB color space for best results.

PFCImageFile imageFile = new PFCImageFile();
if (imageFile.LoadImage("input.jpg", true, null) != PFCImageFile.PFC_FILE_LOAD_STATUS.LOAD_OK)
{
    Console.WriteLine("Failed to load image");
    return;
}

A sample image is included in the SDK at sample image, or use any JPEG image of your choice.

Apply auto-correction

Set a correction preset, run the analysis with Calc(), then apply corrections with Apply().

pfc.SetParam(PFCPRESETID.PRESET_VIVID);
pfc.Calc(ref imageFile, PFCFEATURE.CALC_ALL, -1, null);
PFCAPPLYSTATUS result = pfc.Apply(ref imageFile, 100);

if (result < 0)
{
    Console.WriteLine($"Correction failed: {result}");
    return;
}
Console.WriteLine("Image corrected successfully");

Available presets include PRESET_VIVID for landscapes, PRESET_BEAUTIFY for portraits, and PRESET_IAUTO_21 for general photography.

Save output

Save the corrected image using SaveImageFile().

if (imageFile.SaveImageFile("output.jpg", 90, true, true))
{
    Console.WriteLine("Saved to: output.jpg");
}

Parameters are: output path, JPEG quality (0-100), convert back to original color space, and preserve metadata.

Complete example

Create Program.cs:

using System;
using System.Drawing;
using System.IO;
using PerfectlyClearAdapter;

class Program
{
    static void Main(string[] args)
    {
        if (args.Length < 2)
        {
            Console.WriteLine("Usage: quick-dotnet <input.jpg> <output.jpg>");
            return;
        }

        string inputFile = args[0];
        string outputFile = args[1];

        string exePath = AppDomain.CurrentDomain.BaseDirectory;
        string licensePath = Path.Combine(exePath, "sdk_license");

        PerfectlyClear pfc = new PerfectlyClear(licensePath);
        if (pfc == null)
        {
            Console.WriteLine("License activation failed");
            return;
        }
        Console.WriteLine("SDK license activated successfully");

        PFCImageFile imageFile = new PFCImageFile();
        if (imageFile.LoadImage(inputFile, true, null) != PFCImageFile.PFC_FILE_LOAD_STATUS.LOAD_OK)
        {
            Console.WriteLine($"Failed to load image: {inputFile}");
            return;
        }

        pfc.SetParam(PFCPRESETID.PRESET_VIVID);
        pfc.Calc(ref imageFile, PFCFEATURE.CALC_ALL, -1, null);
        PFCAPPLYSTATUS result = pfc.Apply(ref imageFile, 100);

        if (result < 0)
        {
            Console.WriteLine($"Correction failed: {result}");
            return;
        }
        Console.WriteLine("Image corrected successfully");

        if (imageFile.SaveImageFile(outputFile, 90, true, true))
        {
            Console.WriteLine($"Saved to: {outputFile}");
        }
        else
        {
            Console.WriteLine($"Failed to save: {outputFile}");
        }
    }
}

Create quick-dotnet.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <Platform>x64</Platform>
    <ImplicitUsings>disable</ImplicitUsings>
    <Nullable>disable</Nullable>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  </PropertyGroup>

  <PropertyGroup>
    <SdkPath>.\perfectly-clear-sdk</SdkPath>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.cs" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="PerfectlyClearAdapter">
      <HintPath>$(SdkPath)\Win\bin\x64\PerfectlyClearAdapter.dll</HintPath>
    </Reference>
    <PackageReference Include="System.Drawing.Common" Version="8.0.0" />
  </ItemGroup>

  <Target Name="CopyDependencies" BeforeTargets="Build">
    <Copy SourceFiles="$(SdkPath)\Win\bin\x64\PerfectlyClearPro.dll" DestinationFolder="$(OutputPath)" />
    <Copy SourceFiles="$(SdkPath)\Win\bin\x64\PerfectlyClearAdapter.dll" DestinationFolder="$(OutputPath)" />
    <Copy SourceFiles="$(SdkPath)\Win\bin\x64\PFCImageFile.dll" DestinationFolder="$(OutputPath)" />
    <Copy SourceFiles="$(SdkPath)\Win\bin\x64\exiv2.dll" DestinationFolder="$(OutputPath)" />
    <Copy SourceFiles="$(SdkPath)\Win\bin\x64\v3.looks" DestinationFolder="$(OutputPath)" />
  </Target>

  <Target Name="CopyLicense" AfterTargets="Build">
    <ItemGroup>
      <LicenseFiles Include="$(SdkPath)\sdk_license\**\*" />
    </ItemGroup>
    <Copy SourceFiles="@(LicenseFiles)" DestinationFolder="$(OutputPath)\sdk_license\%(RecursiveDir)" />
  </Target>

</Project>

Build and run:

dotnet build
dotnet run -- input.jpg output.jpg

Expected output:

SDK license activated successfully
Image corrected successfully
Saved to: output.jpg

PFC-SDK Version 10.7.2.1269 built from 4fa849d8101945eea725a08dd0dae5101f090fa0 on 11-10-2025.

Copyright © 2026 EyeQ Imaging Inc. All rights reserved.

On this page