CanonEOSLib. An Adobe Native Extension to control a DSLR Canon camera

CanonEOSLib is an Adobe native extension for Windows that allows to control a Canon DSLR camera from an Adobe Air application. Following features are supported:

  1. Read or modify camera settings: Iso, Metering Mode, AeMode, Av, Tv, Image Quality, Exposure Compensation.
  2. Take pictures and save them on the file system.
  3. Press the shutter in three different ways.
  4. Capture the Live Preview signal.
  5. Change Live Preview focus.

CanonEosLib Sample App

Sample app using CanonEOSLib ANE

The extension should work – according to the manufacturer’s data – with the following models: Canon EOS-1Ds Mark III, Canon EOS-1D Mark IV, Canon EOS 5D Mark III, Canon EOS 5D Mark II, Canon EOS 7D, Canon EOS 60D, Canon EOS 600D/Rebel T3i, Canon EOS 550D/Rebel T2i, Canon EOS 1100D/Rebel T3 o Canon EOS 1000D/Rebel XS. Development and testing have been done with Canon EOS 1000D/Rebel XS.

Starting communication with the camera:

Using the following code we create the extension and we obtain a CanonEOSCamera object. This object represents a remotely connected camera and it is used to pass commands or to retrieve setting values. If multiple cameras are connected, we’ll get access only to one of them.

// init camera object
var canonLib : CanonEOSLib  = new CanonEOSLib();
var camera Camera : CanonEOSCamera = canonLib.getCamera();
camera.addEventListener( StatusEvent.STATUS, onChangeStatus );
// release camera object
camera.removeEventListener( StatusEvent.STATUS, onChangeStatus );

Read or modify settings:

In order to read or modify the camera settings there are three kind of methods we can use:

  1. Read the setting value, for example getIso()
  2. Get the possible values related with a setting​​, these values ​​change according to the camera model, current mode, etc. For example, if we set the camera to manual mode the setting values of ISO, Image Quality among others will be enabled and ready to modify, however, in video mode the only setting enabled is Exposure Compensation.
  3. Define a new value. For example setIso( newValue : uint ) . This new value must be in the list of possible values, if not, the camera will ignore the command.

For example, to obtain the current ISO value:

// get the current value
var currentIso : unit  = camera.getIso();
// get possible values
// EDSDKTypes.kEdsPropID_ISOSpeed is
// a constant value representing the parameter Iso
var possibleValues : Array = new Array();

camera.getCameraPropertyDesc( EDSDKTypes.kEdsPropID_ISOSpeed,  possibleValues );
// set new value
var newIso : uint = 0x48;
var result : Boolean = camera.setIso( newValue );

The functions available to read or modify camera settings are:
// ISO
setIso( newValue : uint )
// Aperture
setAv( newValue : uint )
// Velocity
setTv( newValue : uint )
// AeModes ( Program, Manual, ...)
setAeMode( newValue : uint )
// Metering mode
setMeteringMode( newValue : uint )
// Image quality
setImageQuality( newValue : uint )
// Exposure compensation
setExposureCompensation( value : uint )

The getEVF(bitmapData) method captures the content visible on the Live Preview screen if it is active. To obtain a video sequence, the method should be called every time the camera dispatchs an EvfDataChanged event. This type of event notifies us the content of Live Preview has changed.


How to use Canon libraries

In order to connect the Adobe AIR runtime with the camera is essential to have the Windows libraries provided by Canon. You can get them at Canon program developers. The libraries you need are: EdsImage.dll,EDSDK.dll, DPPRSC.dll, DPPLibCom.dll and

We also require two files related with the Visual Studio: msvcp100.dll and msvcr100.dll or have .Net Framework 4.0 installed.

If we develop an C++ application, a single installer file is generated. This file contains extra files such as DLLs and it can be distributed as a whole. In case of an AIR app, we should add the .dll files to the src folder and then use the Flash Builder wizard to include them as part of the executable file.


Export to native installer


CanonEOSLib is another example of how to extend the capabilities of Adobe AIR. In the future, the extension could be extended to support multicamera functionality or maybe it could try to repeat the same functionality but using a Nikon camera.

Leave a comment