Picture Transfer Protocol

Picture Transfer Protocol (PTP) is a protocol developed by the International Imaging Industry Association to allow the transfer of images from digital cameras to computers and other peripheral devices without the need of additional device drivers.  The protocol has been standardized as ISO 15740.

It is further standardized for USB by the USB Implementers Forum as the still image capture device class. USB is the default network transport media for PTP devices. USB PTP is a common alternative to the USB mass-storage device class (USB MSC), as a digital camera connection protocol. Some cameras support both modes.

Description
PTP specifies a way of creating, transferring and manipulating objects which are typically photographic images such as a JPEG file. While it is common to think of the objects that PTP handle as files, they are abstract entities identified solely by a 32-bit object ID. These objects can however have parents and siblings so that a file-system–like view of device contents can be created.

History
Until the standardization of PTP, digital camera vendors used different proprietary protocols for controlling digital cameras and transferring images to computers and other host devices.  The term "Picture Transfer Protocol" and the acronym "PTP" were both coined by Steve Mann, summarizing work on the creation of a Linux-friendly way of transferring pictures to and from home-made wearable computers, at a time when most cameras required the use of Microsoft Windows or Mac OS device drivers to transfer their pictures to a computer.

PTP was originally standardized as PIMA 15470 in 2000, while it was developed by the IT10 committee. Key contributors to the standard included Tim Looney and Tim Whitcher (Eastman Kodak Company) and Eran Steinberg (Fotonation).

Storage
PTP does not specify a way for objects to be stored – it is a communication protocol. Nor does it specify a transport layer. However, it is designed to support existing standards, such as Exif, TIFF/EP, DCF, and DPOF, and is commonly implemented over the USB and FireWire transport layers.

Images on digital cameras are generally stored as files on a mass storage device, such as a memory card, which is formatted with a file system, most commonly FAT12, FAT16 or FAT32, which may be laid out as per the Design rule for Camera File system (DCF) specification. But none of these are required as PTP abstracts from the underlying representation.

By contrast, if a camera is mounted via USB MSC, the physical file system and layout are exposed to the user.

Device control
Many modern digital cameras from Canon and Nikon can be controlled via PTP from a USB host enabled computing device (Smartphone, PC or Arduino for example).  As is the norm for PTP, the communication takes place over a USB connection.  When interacting with the camera in this manner, it is expected that the USB endpoints are in (synchronous) Bulk Transfer Mode, for getting/setting virtually all the camera's features/properties (such as ISO, Aperture, Shutter speed and focus).  Events raised by the camera, in response to specific actions performed by the host device, are sent back to the host via the USB asynchronous Interrupt endpoint.

In addition to changing the camera's settings and operating mode, it is possible to receive a through-the-lens view using "Live View". As described above, the storage objects of the camera's memory cards can be manipulated too.

By controlling a camera in this way it is possible to augment its capabilities.  For example, if the controlling software was running on a Smartphone with GPS functionality, it would be possible to add the GPS coordinates to an image's Exif data, at the time of image capture - even if the camera itself had no GPS functionality.

Extensions
A number of protocols have been developed that extend PTP. PTP/IP, developed by FotoNation and first implemented in a round of Wi-Fi digital cameras by Nikon, Canon, and Eastman Kodak, allows data transfer over any IP-based network.

Media Transfer Protocol (MTP), developed by Microsoft, allows for transfer over wireless or wired networks based in part on FotoNation's PTP/IP, but also allows users to transfer other media aside from pictures, as well as for tagging objects with extended metadata (such as title, artist and similar).

Operating system support
Microsoft Windows has supported PTP from Windows ME onwards (excluding Windows CE). Microsoft implements PTP on Windows through Windows Image Acquisition.  A disadvantage of PTP on Windows as compared to USB mass storage is that Windows does not assign drive letters to PTP devices, so image files on them cannot be manipulated by scripts or standard Windows programs, only by Windows Explorer or applications with specially written PTP support.  Also, Windows Explorer does not display file modification timestamps (though these are available via the file Properties popup).   

PTP on Linux and other free and open-source operating systems is supported by a number of libraries, such as libgphoto and libptp, used by applications such as digiKam and F-Spot. As on Microsoft Windows there is no native support on Linux, but by means of GVfs the devices can easily be mounted and made available to applications that use standard POSIX commands and library functions.

Android has PTP support, although as with MTP, a limitation is that when transferring photos from one's computer to the Android device, file timestamps are replaced with the time of the copy (with copies in the other direction, from device to computer, timestamps are preserved).

The Poseidon USB stack on Amiga includes ptp.class.

Version 1.1
PTP v1.1 (ISO 15740:2008) is an update to PTP published by ISO.

This updated version of PTP is fully backward-compatible with PTP v1.0, and offers optional performance, compatibility, and feature enhancements including:
 A mechanism for handling streaming content
 A mechanism to support multiple vendor extension sets
 Support for objects larger than the 4GiB size limit set by PTP v1.0, by requiring 64 bits (8 bytes) for object size
 Support for retrieval of ObjectHandles in enumerated chunks. This may reduce long response times for some devices that possess large numbers of objects
 Support for arbitrary resizing prior to image transmission (responder scaling). In PTP v1.0, image sizes might be requested in full-resolution or thumbnail size only
 Support for arrays of datasets. This can be used to reduce the number of required transactions necessary for device characterization from being a function of the number of objects on the device down to one
 A fast file characterization operation that exploits dataset arrays to request, in a single transaction, only the minimum data required to characterize a typical filesystem
 A new standard ObjectFormatCode to support the Digital Negative (DNG) file format

Drawbacks
 Renaming file objects directly is not possible without copying or rewriting them
 Modification of file contents is not supported (the file needs to be re-transferred completely)
 Some drawbacks are OS-specific — see

See also
 Design rule for Camera File system
 PictBridge

References

External links
 
 PTP transport over USB specifications, USB.org.
 Microsoft and FotoNation Team to Support the Media Transfer Protocol For Wireless Digital Still Cameras, Microsoft News Center.
 Free software with PTP support

Digital photography
Network protocols
ISO standards
Computer-related introductions in 2000
USB