The Image Capture Architecture (part of Carbon.framework
) is a high-level framework for capturing image data from devices such as scanners, digital cameras, phones and PDAs. The Image Capture interfaces are device independent, so you can use them to gather data from any devices connected to the system. You can get a list of devices, retrieve information about a specific device or its contents, and retrieve filesâÂÂincluding images, movies, and sound filesâÂÂfrom devices. You can also issue commands to devices that support this feature, to initiate a document scan, take a photo, or delete an image from a camera card, for example.
Mac OS X provides a set of image capture services that enable you to do the following:
Detect when an image capture device, such as a scanner or camera, has been attached to the host computer via USB or FireWire.
Launch a browser that detects image capture devices available over Bluetooth or TCP/IP network connections and attach them
Obtain a detailed list of attached devices and their properties, including directories of images and image metadata
Download images from devices such as cameras and scan images using scanners
Detect and use special functions for particular devices, such as the ability to capture a new image or delete existing images
Write applications that are automatically launched when an appropriate device is attached
Create device modules for new devices, such as cameras, scanners, phones, and PDAs, so they can be accessed using the Image Capture Architecture framework
Architecture
Sequence of Events
TWAIN Compatibility
Device Browser
There are three pieces to the Image Capture Architecture:
Image Capture device modules, which are launched when a particular image capture device is attached. If you are adding a new scanner, camera, or other image capture device to Mac OS X, you need to write an image capture device module. The API for writing device modules is part of the Image Capture Device framework (ICADevice.framework
). (See Image Capture Device Modules Reference.)
Image Capture API functions for cocoa and carbon programmers. These system-level extensions enable applications to work with attached devices at a high level. This API is part of the Image Capture framework (Carbon/ImageCapture/ImageCapture.h
). It is described in this document and in Image Capture Applications Reference.
Image Capture Extension.app
, a faceless application that runs in the background and provides the connections between device modules and the applications, shielding applications programmers from having to deal with individual devices, and providing a common interface between device modules and applications.
The image capture services architecture is conceptually somewhat similar to TWAIN architecture, with the image capture extension taking the place of the TWAIN data source manager and the the device module taking the place of the TWAIN data source, as shown in Figure 1-1.
The Image Capture applications, extension, and device modules are all run in separate processes, making it possible to dynamically add device modules into the mix, share devices among applications, access devices from applications running on separate host computers, and even access device modules from applications running on different CPU architectures, as shown in Figure 1-2.
As illustrated, it is possible for applications on one computer to access device modules running on another computer. It is also possible for multiple applications to access multiple devices, and for multiple applications to share access to a single device.
The process operates as follows: when a device is connected to the host computer, via FireWire or USB, or an image-capture device is attached from a Bluetooth or TCP/IP network connection, the operating system searches among the installed device modules for the most suitable one, using the device module's associated DeviceInfo.plist
. (If more than one module is installed for a given device, the system selects the highest CFBundle
version number, taken from the Info.plist
file.)
If an application is configured to be launched when this type of device is detected, that application is launched. For example, connecting a digital camera or pushing the "scan" button on a scanner can invoke your application without user intervention.
Note: In order to have your application launched when a device is attached, instruct your end user to run the Image Capture application and select your application in the dialog box presented by the Image Capture > Preferences menu.
When launched, your application obtains a device list object from the Image Capture API, chooses a device from the list, and obtains the dictionary for that device. The dictionary contains a list of objects associated with the device, such as images, movies, audio files, and directories.
The dictionary for the device also includes information about the device, such as whether it supports capturing images on command or deleting images. You can use the Image Capture API to issue such commands to the device.
Your application can download the objects of interest directly or obtain a dictionary of metadata specific to individual objects to determine whether they should be downloaded.
Note: Earlier versions of image capture services required the application to iterate through the device list to determine each device type, then iterate through the objects contained on a device, such as images, audio files, and directories. The API for this earlier method is still in the headers for backward compatibility, but the new API, using dictionaries rather than iterating through the object hierarchy, is recommended, and is the API documented in the following chapter.
Image capture applications should register for notification of image capture events, such as the addition of new devices, the removal of existing devices, or the change of storage in an existing device, such as the insertion of a new memory card into a mounted camera or card reader.
Image capture devices can be accessed using the native image capture API described in this document, or they can be accessed as TWAIN data sources. In order for devices to be recognized by TWAIN applications as well as Image Capture applications, the device manufacturer must provide both a TWAIN data source module and an Image Capture device module. If both are available, the system uses the Image Capture device module by default, and the TWAIN data source when needed.
An Image Capture application has access to all attached image capture devices. USB and FireWire devices are automatically attached when they are connected, but Bluetooth and TCP/IP network devices may not be. The Image Capture API includes a device browser that your application can invoke, allowing the end user to browse for available devices and attach them. Once mounted, they appear in the device list object when it is next obtained. Device manufacturers should use Bonjour protocol to advertise available TCP/IP network devices.
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-05-16)