Rectangle 27 0

        Hello World
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, 
    width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <script type="text/javascript" src="phonegap.js">
    <script type="text/javascript">

    //Base64code  indicate about our canvas base64.
     var Base64code = "iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAgAElEQVR42sS9d5xl11Xn+937hJtj5djVObdaauVkWZIt29gYbDlhjHkwJANDmmGY8ObBzGMew4c3MDAwQ3jYfgYeOQx4HL";

        document.addEventListener("deviceready", onDeviceReady, false);

        function onDeviceReady() {
            cordova.exec(function(winParam) {
            }, function(error) {}, "Base64toImagePlugin", "base64Data", [Base64code]);

Java code of Plugin class name :

package com.inic.base64toimage.Plugin;

    import android.os.Environment;
    import android.util.Base64;
    import android.util.Log;

    import org.apache.cordova.CallbackContext;
    import org.apache.cordova.CordovaPlugin;
    import org.json.JSONArray;
    import org.json.JSONException;


     * Created by ind652 on 08/10/13.
    public class Base64toImagePlugin extends CordovaPlugin {

        public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {

            if (action.equals("base64Data")) {

                Log.i("BASE64DATA", "FastCanvas queueing set background color " + args.getString(0));

                byte[] imageAsBytes = Base64.decode(args.getString(0).getBytes(), 0);
                Bitmap b=  BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length);
                return true;

                return false;


        private boolean storeImage(Bitmap imageData, String filename) {
            //get path to external storage (SD card)
            String iconsStoragePath = Environment.getExternalStorageDirectory() + "/myAppDir/amit/";
            File sdIconStorageDir = new File(iconsStoragePath);

            //create storage directories, if they don't exist

            try {
                String filePath = sdIconStorageDir.toString() + filename;
                FileOutputStream fileOutputStream = new FileOutputStream(filePath);

                BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);

                //choose another format if PNG doesn't suit you
                imageData.compress(Bitmap.CompressFormat.PNG, 100, bos);


            } catch (FileNotFoundException e) {
            //    Log.i("TAG", "Error saving image file: " + e.getMessage());
                return false;
            } catch (IOException e) {
          //      Log.i("TAG", "Error saving image file: " + e.getMessage());
                return false;

            return true;

com.inic.base64toimage.Plugin is package name where you can create plugin class

<feature name="Base64toImagePlugin">
    <param name="android-package" value="com.inic.base64toimage.Plugin.Base64toImagePlugin" />

Thanks Amit, I guess I should just use a plugin. I just thought I was so close without using a plugin, just that the file format is wrong, for some reason.

javascript - Saving image from Html5 canvas to phone storage - Stack O...

javascript android html5 cordova html5-canvas
Rectangle 27 0

The Camera.Face class returns the face bound coordinates using the image frame that the phone would save into its internal storage, rather than using the image displayed in the Camera Preview. In my case, the images were saved in a different manner from the camera, resulting in a incorrect mapping. I had to manually account for the discrepancy by taking the coordinates, rotating it counter clockwise 90 degrees and flipping it on the y-axis prior to scaling it to the canvas used for the custom view.

EDIT: It would also appear that you can't change the way the face bound coordinates are returned by modifying the camera capture orientation using the Camera.Parameters.setRotation(int) method either.

android - Converting Camera Coordinates to Custom View Coordinates - S...

android android-camera android-canvas android-custom-view coordinate-systems
Rectangle 27 0

You are almost there. The Canvas2ImagePlugin.js expects a proper implementation of canvas, which is not available for older Android versions (like Froyo). Just get the base64 data url using the method you've mentioned and pass the value inside the Canvas2Image plugin to imageData.

Thanks for your help, but I need for Android unfortunately, dyu know any plug-in, and tutorials specifically???

These are the instructions for Android. The Canvas2ImagePlugin passes to the native side a base64 encoded representation of the canvas content, which is acquired using toDataURL(). On older Android versions the toDataURL() returns garbage. So, instead of using the toDataURL() you get the same content using the method. This is not ready made but this is all it takes to combine those two plugins to get what you want.

Does Canvas2ImagePlugin give back the path where the file is saves in phones filesystem??

android - Save Canvas As Image to phone storage Phonegap - Stack Overf...

android canvas cordova html5-canvas phonegap-plugins