Building samples
Compile and run sample projects on your platform
This guide covers how to build the sample projects on Linux, macOS, and Windows. The build process is similar across all samples within each platform.
Linux and macOS
The Linux and macOS samples use makefiles for building. Each sample directory contains a makefile that
compiles the sample and copies the required libraries and model files.
Prerequisites
Before building, ensure that you have the following installed:
- GCC/G++ compiler (
g++7.0 or later recommended) pthreadlibrary- Standard development tools (
make) - MacOS development requires Xcode and the command line tools
Build a sample
Navigate to the sample directory and run make.
cd Linux/SimpleAiSample
makeThe makefile compiles the source code and copies all required files (libraries, model files, looks files) into the sample directory.
Run the sample
After building, run the executable directly.
./PerfectlyClear input.jpg output.jpg -vMakefile structure
Each makefile follows this pattern below. There are path and complier options that are unique to each OS and architecture.
cc=g++
cflags=-O2 -pthread -D_LINUX -I../header -Wl,-R'$$ORIGIN/../bin'
all: PerfectlyClear
PerfectlyClear: SimpleAiSample.cpp
${cc} ${cflags} -m64 -o $@ SimpleAiSample.cpp \
../bin/libPerfectlyClearPro.a \
../bin/libPFCImageFile.a \
../bin/libwebp.a \
../bin/liblcms2.so.2 \
../bin/libexiv2.so.26 \
-ldl
# Copy required model files
cp ../bin/*.pnn .
cp ../bin/libPFCAIEngine.so .
cp ../bin/libonnxruntime.so.1.5.1 .
cp ../bin/v3.looks .Required files
After building, these files must be in the same directory as the executable. Other supporting libraries or AI models might be needed for your specific implementation.
| File | Purpose |
|---|---|
libPFCAIEngine.* | AI engine library |
libonnxruntime.* | ONNX runtime for AI models |
pro_and_universal_*.pnn | Scene detection model |
skintone_*.pnn | Skin tone detection model |
dynamic.pnn | Dynamic AI corrections model |
aicolor.pnn | AI white balance model |
facemesh.pnn, faceshape.pnn | Face mesh models |
fdfront.pnn, fdback.pnn | Face detection models |
v3.looks | LUT/Looks file |
Windows (C++)
The Windows C++ samples use Visual Studio solution files (.sln) for building.
Prerequisites
Ensure that you have the following installed:
- Visual Studio 2019 or later
- Windows SDK
Build a sample
Follow the steps to build a sample:
- Open the solution file (
SimpleAiSample.sln) in Visual Studio - Select the Release configuration and x64 platform
- Build the solution (F7 or Build → Build Solution)
Output location
The compiled executable is placed in the project's output directory. Before running, copy the
required DLLs and model files from Win/bin/x64/ to the executable directory.
Required files
Copy these files from Win/bin/x64/ to your output directory:
| File | Purpose |
|---|---|
PerfectlyClearPro.dll | Core correction library |
PFCImageFile.dll | Image file helper library |
PFCAIEngine.dll | AI engine library |
onnxrunt151.dll | ONNX runtime |
exiv2.dll | EXIF metadata library |
*.pnn | AI model files |
v3.looks | LUT/Looks file |
For PDF processing, also include PFCPDF.dll and podofo.dll.
Windows (C# / .NET)
The C# samples include both .NET Framework and .NET Core projects.
.NET Framework samples
Build and copy the .NET sample files as follows:
- Open the solution file (e.g.,
CSharp_SimpleAiSample.sln) in Visual Studio - Build the solution
- Copy required DLLs from
Win/bin/x64/to the output directory
.NET Core samples
The .NET Core samples include PreBuildEvent steps in the .csproj file that automatically copy required libraries.
<PropertyGroup>
<PreBuildEvent>
xcopy /C /E /Y /R ..\..\..\bin\x64\PerfectlyClearPro.dll .
xcopy /C /E /Y /R ..\..\..\bin\x64\PerfectlyClearAdapter.dll .
xcopy /C /E /Y /R ..\..\..\bin\x64\PFCImageFile.dll .
xcopy /C /E /Y /R ..\..\..\bin\x64\exiv2.dll .
</PreBuildEvent>
</PropertyGroup>If you get build errors related to PreBuildEvent paths, then adjust the relative paths in the .csproj file.
Some Visual Studio versions add an extra directory level, requiring one fewer ..\\ in each path.
Required .NET assemblies
Both .NET Framework and .NET Core projects require these assemblies:
| File | Purpose |
|---|---|
PerfectlyClearAdapter.dll | .NET wrapper assembly |
PerfectlyClearPro.dll | Core correction library |
PFCImageFile.dll | Image file helper |
PFCAIEngine.dll | AI engine |
*.pnn | AI model files |
License configuration
All samples require the SDK license path to be configured. You can either:
- Set the
PFC_SDK_LICENSEenvironment variable - Modify the source code to specify your license path
Set license path in C/C++:
// C/C++
int code = PFC_SetProtectionPath("/path/to/sdk_license");Set license path in C#:
// C#
PerfectlyClear Pfc = new PerfectlyClear("C:\\path\\to\\sdk_license");PFC-SDK Version 10.7.2.1269 built from 4fa849d8101945eea725a08dd0dae5101f090fa0 on 11-10-2025.
Copyright © 2026 EyeQ Imaging Inc. All rights reserved.