Skip to content

Commit

Permalink
Add support to get and set desired image format
Browse files Browse the repository at this point in the history
This PR adds possibility for the web developers to get formats supported by the UA and set desired format for the captured photo.

Fixes #162
  • Loading branch information
Alexander Shalamov committed Jun 26, 2017
1 parent e2590a1 commit 8d33d2e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions implementation-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Feature/Platform | Android | Linux/Chrome
└ imageHeight | ✓ | ✓ | ✓ | ✓ |
└ imageWidth | ✓ | ✓ | ✓ | ✓ |
└ redEyeReduction | ✓ | | | |
└ imageFormat | | | | |
`MediaTrack`* | | | | |
└ brightness | | ✓ | | |
└ colorTemperature |60 ([724626](https://crbug.com/724626))| ✓ | 60 ([657128](https://crbug.com/657128)) | |
Expand Down
21 changes: 21 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ interface ImageCapture {
readonly attribute MediaSettingsRange imageHeight;
readonly attribute MediaSettingsRange imageWidth;
readonly attribute FrozenArray<FillLightMode> fillLightMode;
readonly attribute FrozenArray<DOMString> imageFormat;
};
</pre>

Expand All @@ -229,6 +230,9 @@ interface ImageCapture {

<dt><dfn attribute for="PhotoCapabilities"><code>fillLightMode</code></dfn></dt>
<dd>This reflects the supported <a>fill light mode</a> (flash) settings, if any.</dd>

<dt><dfn attribute for="PhotoCapabilities"><code>imageFormat</code></dfn></dt>
<dd>This reflects the <a>image format</a> supported by the UA.</dd>
</dl>

<div class="note">
Expand All @@ -243,6 +247,7 @@ interface ImageCapture {
double imageHeight;
double imageWidth;
boolean redEyeReduction;
DOMString imageFormat;
};
</pre>

Expand All @@ -260,6 +265,9 @@ interface ImageCapture {

<dt><dfn dict-member for="PhotoSettings"><code>fillLightMode</code></dfn></dt>
<dd>This reflects the desired <a>fill light mode</a> (flash) setting.</dd>

<dt><dfn dict-member for="PhotoSettings"><code>imageFormat</code></dfn></dt>
<dd>When the UA returns a {{Blob}} from {{takePhoto()}}, the format and {{Blob/type}} MUST be one of the supported <a>image formats</a> enumerated in {{PhotoCapabilities/imageFormat}}, if any.</dd>
</dl>


Expand Down Expand Up @@ -711,6 +719,9 @@ When the {{getSettings()}} method is invoked on a video stream track, the user a
<li><dfn>Zoom</dfn> is a numeric camera setting that controls the focal length of the lens. The setting usually represents a ratio, e.g. 4 is a zoom ratio of 4:1. The minimum value is usually 1, to represent a 1:1 ratio (i.e. no zoom).</li>

<li><dfn>Fill light mode</dfn> describes the flash setting of the capture device (e.g. |auto|, |off|, |on|). <dfn>Torch</dfn> describes the setting of the source's fill light as continuously connected, staying on as long as {{track}} is active.</li>

<li><dfn>Image format</dfn> is the ASCII-encoded string in lower case describing the format of an image. The <a>image format</a> string MUST be a <a>valid MIME type</a>, whose <a>type</a> MUST be an </a>image media type</a> and <a>subtype</a> MAY be one of the <a>IANA registered image subtypes</a>. The UA should be able to display any of the supported image formats.
</li>
</ol>

# {{MeteringMode}} # {#meteringmode-section}
Expand Down Expand Up @@ -1041,6 +1052,16 @@ urlPrefix: https://www.w3.org/TR/mediacapture-streams/#; type: dictionary; text:


urlPrefix: https://www.w3.org/TR/mediacapture-streams/#; type: dfn; text: constrainable property; url: defining-a-new-constrainable-property

urlPrefix: https://mimesniff.spec.whatwg.org/#; spec: MIMESNIFF
type: dfn
text: valid mime type; url: valid-mime-type
text: type; url: type
text: subtype; url: subtype
text: image media type; url: image-type
urlPrefix: https://www.iana.org/assignments/media-types/; spec: IANA-MEDIA-TYPES
type: dfn
text: IANA registered image subtypes; url: image
</pre>

<pre class="link-defaults">
Expand Down

0 comments on commit 8d33d2e

Please sign in to comment.