Get ready to apply a sepia effect to an image acquired using the Capture API. Execute the following steps:
Open the command-line tool and create a new PhoneGap project named
ImageEffect
.$ cordova create ~/the/path/to/your/source/imageEffect com.gnstudio.pg.ImageEffect ImageEffect
Add the Capture API plugin using the command line.
$ cordova plugins add https: //git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
Add to the existing markup a
canvas
tag with theid
value#manipulatedImage
in order to use it to render the manipulated image.<canvas id='manipulatedImage' />
Once the
deviceready
event has been fired, access the device camera, allowing the user to get only one image.var capture = navigator.device.capture; capture.captureImage(onGetImage, onImageError, {limit: 1});
Define the success handler in the
index.js
file and access to the file information stored in the array returned as an argument.onGetImage: function(files...