Skip to main content
net10.0

Canon CR2 / CR3 raw-file decoder β€” pure managed C#, no external libraw / dcraw / EDSDK. Sibling to FC.SDK (Canon PTP device communication): one package for talking to the camera, one for decoding the files it writes.

Published
Jul 5, 2026
3mo ago
Total Downloads
9.9K
9,919

Install

dotnet add package FC.SDK.Raw --version 1.4.521
ProductVersions
.NET
net10.0

README

FC.SDK β€” Free Canon SDK

Canon EOS camera control via PTP over USB and WiFi β€” pure managed C#, no EDSDK binary required.

Why

Canon's EDSDK is closed-source, non-redistributable, and Windows-only. FC.SDK implements the same camera control capabilities using the PTP protocol (reverse-engineered by the libgphoto2 project), working over USB and WiFi on any platform.

Transports

Transport Platform Driver swap? Notes
WPD (Windows Portable Devices) Windows None β€” plug & play Uses stock MTP driver, AOT compatible
USB (LibUsbDotNet) Linux/macOS/Windows WinUSB on Windows Cross-platform, lowest latency
PTP/IP (WiFi) All None TCP port 15740, no cable needed

Usage

using FC.SDK;
using FC.SDK.Canon;

// Connect via WPD (Windows, zero-install)
await using var camera = CanonCamera.ConnectWpd(deviceId);
await camera.OpenSessionAsync();
Console.WriteLine($"{camera.Model} β€” serial {camera.SerialNumber}, battery {camera.BatteryLevelPercent}%");

// Typed settings β€” no magic uint32s
await camera.SetISOAsync(EdsISOSpeed.ISO_800);
await camera.SetShutterSpeedAsync(EdsTv.Tv_1_125);
await camera.SetApertureAsync(EdsAv.Av_2_8);

// Snap and download (auto-detects CR2, CR3, JPG)
await camera.SetSaveToAsync(EdsSaveTo.Host);
camera.ObjectAdded += async (s, e) =>
{
    var (_, fileName) = await camera.GetObjectFileNameAsync(e.ObjectHandle);
    await using var fs = File.Create(fileName ?? "capture.cr2");
    await camera.DownloadAsync(e.ObjectHandle, fs);
    await camera.TransferCompleteAsync(e.ObjectHandle);
};
camera.StartEventPolling();
await camera.TakePictureAsync();

// Bulb exposure (mode dial must be on B)
await camera.SetMirrorLockupAsync(EdsMirrorUpSetting.On);
await camera.BulbStartAsync();
await Task.Delay(TimeSpan.FromSeconds(120));
await camera.BulbEndAsync();

// Live view + manual focus
await camera.StartLiveViewAsync();
var (error, jpeg) = await camera.GetLiveViewFrameAsync();
await camera.DriveLensAsync(EdsDriveLensStep.NearSmall);
await camera.StopLiveViewAsync();

Architecture

CanonCamera              (public async API)
  CanonPtpSession        (Canon vendor opcodes 0x9xxx)
    PtpSession           (transaction management, half-duplex lock)
      IPtpTransport      (WPD / USB / PTP-IP)

Feature Matrix

Feature FC.SDK Canon.EDSDK (.NET) Canon EDSDK.dll (native)
Take picture yes yes yes
Bulb exposure yes yes yes
Download CR2/CR3/JPEG yes yes yes
Live view (MJPEG) yes yes yes
Manual focus (DriveLens) yes yes yes
Read/write ISO, Tv, Av yes yes yes
Event polling (GetEvent) yes yes yes
Mirror lockup control yes yes yes
WPD (zero-install, Windows) yes no (wraps EDSDK.dll) internally, not exposed
USB (LibUsbDotNet, cross-plat) yes no Windows only
WiFi (PTP/IP) yes no yes
Linux / macOS yes (USB, WiFi) no no
NativeAOT compatible yes yes n/a
Redistributable MIT LGPL no (Canon license)
Requires vendor binary no yes (EDSDK.dll) yes (EDSDK.dll)
Requires driver swap (Zadig) WPD: no, USB: yes n/a no

Canon.EDSDK (SharpAstro/Canon.EDSDK) is a .NET binding around Canon's native EDSDK.dll. It requires the vendor binary and only runs on Windows. FC.SDK reimplements the PTP protocol directly and needs no vendor DLLs.

Supported Cameras

Tested with Canon EOS 6D. Should work with any Canon EOS body that supports PTP β€” the Canon vendor opcodes are shared across the EOS lineup.

AOT Compatible

The entire library including the WPD transport is NativeAOT compatible β€” no dynamic, no reflection, all COM interop via [GeneratedComInterface].

License

MIT

Changes from Previous Version

No structural changes between v1.4.511 and v1.4.521.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.