ImageCapture: getPhotoCapabilities() method

The getPhotoCapabilities() method of the ImageCapture interface returns a Promise that resolves with an object containing the ranges of available configuration options.

Syntax

js
getPhotoCapabilities()

Parameters

None.

Return value

A Promise that resolves with an object containing the following properties:

redEyeReduction

Returns one of "never", "always", or "controllable". The "controllable" value means the device's red-eye reduction is controllable by the user.

imageHeight

Returns an object indicating the image height range supported by the user agent.

imageWidth

Returns an object indicating the image width range supported by the user agent.

fillLightMode

Returns an array of available fill light options. Options include auto, off, or flash.

Exceptions

InvalidStateError DOMException

Thrown if readyState property of the MediaStreamTrack passing in the constructor is not live.

OperationError DOMException

Thrown if the operation can't complete for any reason.

Examples

The following example, extracted from Chrome's Image Capture / Photo Resolution Sample, uses the results from getPhotoCapabilities() to modify the size of an input range. This example also shows how the ImageCapture object is created using a MediaStreamTrack retrieved from a device's MediaStream.

js
const input = document.querySelector('input[type="range"]');

let imageCapture;

navigator.mediaDevices
  .getUserMedia({ video: true })
  .then((mediaStream) => {
    document.querySelector("video").srcObject = mediaStream;

    const track = mediaStream.getVideoTracks()[0];
    imageCapture = new ImageCapture(track);

    return imageCapture.getPhotoCapabilities();
  })
  .then((photoCapabilities) => {
    const settings = imageCapture.track.getSettings();

    input.min = photoCapabilities.imageWidth.min;
    input.max = photoCapabilities.imageWidth.max;
    input.step = photoCapabilities.imageWidth.step;

    return imageCapture.getPhotoSettings();
  })
  .then((photoSettings) => {
    input.value = photoSettings.imageWidth;
  })
  .catch((error) => console.error("Argh!", error.name || error));

Specifications

Specification
MediaStream Image Capture
# dom-imagecapture-getphotocapabilities

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getPhotoCapabilities
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support