Class: ImageObject

ImageObject(image)

new ImageObject(image)

Parameters:
Name Type Description
image image properties which are used to create the image object

Methods

base64Image(successCallback, errorCallback)

Method to convert an image to the form of base64string from a Image.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function and will have the base64 string of the image successCallback - Get the base 64 string. errorCallback - Error message would contain the appropriate error description.Possible error is Wrong ImageID.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.base64Image(successCallback,errorCallback);

clearImageBitmap(successCallback, errorCallback)

Method to clear the image bitmap of the KEDImage. clearImageBitmap method of Image is used here.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with 'ErrorMsg' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions. successCallback : KMC_SUCCESS success call back. errorCallback : Error message would contain the appropriate error description.Possible errors are Failed to complete Action - check parameters passed,KmcRuntimeException,KmcException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.clearImageBitmap(successCallback,errorCallback);

deleteFileFromDisk(successCallback, errorCallback)

Method to delete the image from disk. deleteFile method of Image is used here.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with 'ErrorMsg' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions. successCallback : KMC_SUCCESS success call back. errorCallback : Error message would contain the appropriate error description.Possible errors are Failed to complete Action - check parameters passed,KmcRuntimeException,KmcException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.deleteFileFromDisk(successCallback,errorCallback);

deleteImage(successCallback, errorCallback)

Method to delete the imageObject (Image).
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions. successCallback - KMC_SUCCESS success call back. errorCallback - Error message would contain the appropriate error description.Possible error is KmcException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
// do operations with the created image, then to remove the image use
imageObj.deleteImage(successCallback,errorCallback);

getBlob(successCallback, errorCallback)

Method to get raw binary data buffer of the Image.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function and will have ArrayBuffer of the image. successCallback - Get the image ArrayBuffer. errorCallback - Error message would contain the appropriate error description.Possible errors are Wrong ImageID, ArrayBuffer conversion failed.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.getBlob(successCallback,errorCallback);

getImageSize(successCallback, errorCallback)

Method to get the image size for an ImageId.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with 'ErrorMsg' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.getImageSize(successCallback,errorCallback);

imageReadFromFile(successCallback, errorCallback)

Method to get the image bitmap of the Image from disk. imageReadFromFile method of Image is used here.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with 'ErrorMsg' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCB' for an incomplete/invalid operation. Returns the following values in the corresponding functions. successCallback : KMC_SUCCESS success call back. errorCallback : Error message would contain the appropriate error description.Possible errors are Failed to complete Action - check parameters passed,KmcRuntimeException,KmcException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.imageReadFromFile(successCallback,errorCallback);

imageWriteToFile(successCallback, errorCallback, parameters)

Method to write the Images to a disk. SpecifyFilePath and imageWriteToFile methods of Image are used here.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object image Id you would like to write and File Path where you want to write.
Properties
Name Type Attributes Description
imageID String <optional>
image id you would like to write
filePath String <optional>
filepath where you want to write. The filepath needs to include imageName with extension(ex:imageName.png). In iOS, it is not required to pass the documents directory path because internally MobileSDK is getting the documents directory path and appending the file path which is coming from the user. In Android, if we pass imageName with extension then the image will write to phone internal storage. If we pass SD card full path (ex:/storage/emulated/0/imageName.png) then the image will write to SD card.
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with 'ErrorMsg' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions. successCallback - KMC_SUCCESS success call back. errorCallback - Error message would contain the appropriate error description.Possible errors are Failed to complete Action - check parameters passed,Failed to write Image to File - Given Image already in File format., Given File extension is different from Image Mime Type,File path is Invalid,KmcRuntimeException,KmcException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
imageObj.imageWriteToFile(successCallback,errorCallback,{
  imageID:"imageID value",
  filePath:"imageName.png"
});

setOptions(successCallback, errorCallback, parameters)

Method to set the properties of the native Image class. This method will intern call the ImageArray.prototype.setImageProperties to set the properties for a particular image object in the array
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object An 'ImageObject' variable containing the properties to be set to the Image object. The image is uniquely identified by its 'id' property.
Properties
Name Type Attributes Description
imageID String <optional>
image object is identified by using this property
mimeType String <optional>
what mime type you want to set for an image. MIMETYPE_JPG or MIMETYPE_PNG or MIMETYPE_TIF
dpi Number <optional>
how much dpi you want to set for an image
tag Number <optional>
what tag you want to set for an image
filePath String <optional>
filepath you want to write or read the image. The filepath needs to include imageName with extension(ex:imageName.png). In iOS, it is not required to pass the documents directory path because internally MobileSDK is getting the documents directory path and appending the file path which is coming from the user. In Android, if we pass imageName with extension then the image will write to phone internal storage. If we pass SD card full path (ex:/storage/emulated/0/imageName.png) then the image will write to SD card.
jpegQuality Number <optional>
hou much jpeg quality you want to set for an image. this property is applied when user write the image into a specific filepath
createDateTime String <optional>
what time and date you want to set for an image. you have to give ISO 8601 date format string.
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions. successCallback - KMC_SUCCESS success call back. errorCallback - Error message would contain the appropriate error description.Possible errors are Failed to complete Action - check parameters passed,KmcRuntimeException,JSONException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imageObj =  kfxCordova.kfxEngine.createImageObject();
//Set the properties for the image object
imageObj.setOptions(successCallback,errorCallback,{
   imageID: "Give imageID Here",
   mimeType: "MIMETYPE_JPG",
   dpi: 75,
   tag: 1,
   filePath: "imageName.png",
   createDateTime: "Give ISO 8601 Date Format String Here",
   jpegQuality: 75
});