{"id":19370194,"url":"https://github.com/phonegap/phonegap-plugin-image-capture","last_synced_at":"2025-04-23T15:32:02.361Z","repository":{"id":57323077,"uuid":"97488680","full_name":"phonegap/phonegap-plugin-image-capture","owner":"phonegap","description":null,"archived":false,"fork":false,"pushed_at":"2018-05-07T14:39:34.000Z","size":1449,"stargazers_count":11,"open_issues_count":8,"forks_count":8,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-02T17:11:18.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phonegap.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-17T14:57:19.000Z","updated_at":"2021-07-14T22:32:10.000Z","dependencies_parsed_at":"2022-09-10T16:51:57.906Z","dependency_job_id":null,"html_url":"https://github.com/phonegap/phonegap-plugin-image-capture","commit_stats":null,"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fphonegap-plugin-image-capture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fphonegap-plugin-image-capture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fphonegap-plugin-image-capture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phonegap%2Fphonegap-plugin-image-capture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phonegap","download_url":"https://codeload.github.com/phonegap/phonegap-plugin-image-capture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250460541,"owners_count":21434261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T08:14:33.014Z","updated_at":"2025-04-23T15:32:02.006Z","avatar_url":"https://github.com/phonegap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!---\n# license: Licensed to the Apache Software Foundation (ASF) under one\n#         or more contributor license agreements.  See the NOTICE file\n#         distributed with this work for additional information\n#         regarding copyright ownership.  The ASF licenses this file\n#         to you under the Apache License, Version 2.0 (the\n#         \"License\"); you may not use this file except in compliance\n#         with the License.  You may obtain a copy of the License at\n#\n#           http://www.apache.org/licenses/LICENSE-2.0\n#\n#         Unless required by applicable law or agreed to in writing,\n#         software distributed under the License is distributed on an\n#         \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#         KIND, either express or implied.  See the License for the\n#         specific language governing permissions and limitations\n#         under the License.\n--\u003e\n\n\n# phonegap-plugin-image-capture [![Build Status](https://travis-ci.org/phonegap/phonegap-plugin-image-capture.svg)](https://travis-ci.org/phonegap/phonegap-plugin-image-capture)\n\nThis plugin provides an implementation for clicking pictures with a device camera based on the [W3C MediaStream Image Capture API](https://www.w3.org/TR/image-capture/) for iOS and Android. In order to achieve the image capture, this plugin uses the [phonegap-plugin-media-stream](https://github.com/phonegap/phonegap-plugin-media-stream) which is based on the [W3C Media Stream API](https://www.w3.org/TR/mediacapture-streams/). The phonegap-plugin-media-stream makes the mediastream track available to the phonegap-plugin-image-capture which allows the user to click a picture. The phonegap-plugin-media-stream is added as a dependency to the phonegap-plugin-image-capture plugin.\n\n\n\n## Installation\n\n\n    phonegap plugin add phonegap-plugin-image-capture\n\n    phonegap plugin add https://github.com/phonegap/phonegap-plugin-image-capture.git\n\n\n## ImageCapture Constructor\n\nThe ImageCapture constructor uses the mediastream track obtained by using the phonegap-plugin-media-stream to create an object.\n\n### Example\n\n            navigator.mediaDevices.getUserMedia({\n                'audio': true,\n                'video': {\n                    facingMode: 'user'\n                }\n            }).then(function(getmedia) {\n\n                var track = getmedia.getVideoTracks()[0];\n                var imageCapture = new ImageCapture(track);\n            });\n\n\n## The `imageCapture` object\n\nThe imageCapture object has the following methods:\n\n- [takePhoto(optional PhotoSettings photoSettings)](https://github.com/phonegap/phonegap-plugin-image-capture#imagecapturetakephotooptional-photosettings-photosettings)\n- [getPhotoCapabilities()](https://github.com/phonegap/phonegap-plugin-image-capture#imagecapturegetphotocapabilities)\n- [getPhotoSettings()](https://github.com/phonegap/phonegap-plugin-image-capture#imagecapturegetphotosettings)\n- [grabFrame()](https://github.com/phonegap/phonegap-plugin-image-capture#imagecapturegrabframe)\n\n\n\n##  imageCapture.takePhoto(optional PhotoSettings photoSettings)\n\nThe takePhoto() promise accepts an optional PhotoSettings parameter and allows the user to take a picture. The implementation in iOS allows the user to open a camera view and click a picture. Android has integrated support for the [W3C Media Stream API](https://www.w3.org/TR/mediacapture-streams/) and the [W3C MediaStream Image Capture API](https://www.w3.org/TR/image-capture/) from Chrome 59 and the latest Android System Webview. The takePhoto() promise resolves with a `blob` on successful capture of a picture.\n\n### Example\n\n            imageCapture.takePhoto()\n                .then(blob =\u003e {\n                    console.log('Photo taken: ' + blob.type + ', ' + blob.size + 'B');\n                    const image = document.querySelector('img'); // img is an \u003cimg\u003e tag\n                    image.src = URL.createObjectURL(blob);\n                })\n                .catch(err =\u003e console.error('takePhoto() failed: ', err));\n\n\n## imageCapture.getPhotoCapabilities()\n\nThe getPhotoCapabilities() method retrieves the ranges of available configuration options, if any. The promise returns the value of the following four properties if available:\n\n- redEyeReduction : Value can be one of `never` , `always` and `controllable` if available.\n- imageHeight : Has `max`, `min` and `step` values if available.\n- imageWidth : Has `max`, `min` and `step` values if available.\n- fillLightMode : Value can be one of `auto`, `flash` and `off` if available.\n\n\n### Example\n        \n\n            imageCapture.getPhotoCapabilities()\n                .then(function(capabilities){\n                    console.log(capabilities);\n                });\n\n\n## imageCapture.getPhotoSettings()\n\nThis method returns the current configuration values for the settings for taking a picture. The following values are returned by this promise :\n\n- redEyeReduction _(Boolean)_ ,if available.\n- imageHeight  _(Number)_\n- imageWidth  _(Number)_\n- fillLightMode : One of the three values : `auto`, `flash` and `off` ,if available.\n\n### Example\n        \n\n            imageCapture.getPhotoSettings()\n                .then(function(settings){\n                    console.log(settings);\n                });\n        \n\n\n\n## imageCapture.grabFrame()\n\nThis method takes a snapshot of the live video being held in the mediastream track, returning an ImageBitmap if successful. This method is not supported on iOS and rejected promise with `DOMException` is returned.\n\n\n## [Contributing](https://github.com/phonegap/phonegap-plugin-image-capture/blob/master/.github/CONTRIBUTING.md)\n\n## [LICENSE](https://github.com/phonegap/phonegap-plugin-image-capture/blob/master/LICENSE)\n\n## Quirks\n\nIn order to add a `blob` object as a source for an `img` tag, `blob:` should be added to the img-src part of the Content-Security-Policy meta tag in your `index.html` . \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphonegap%2Fphonegap-plugin-image-capture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphonegap%2Fphonegap-plugin-image-capture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphonegap%2Fphonegap-plugin-image-capture/lists"}