Get Width and Height of a Photo Captured from Camera


#1

I’m trying to capture a photo using the device camera, it is returning an imageSource but when I try to get the width by using imageSource.width it is not returning the original width or height:

takePicture({width:1024, height:768, keepAspectRatio:true, saveToGallery: false}).then((function (img){
let source = new imageSourceModule.ImageSource();
source.fromAsset(img).then((imagesource)=>{
console.log(imagesource.width +" – "+ imagesource.height);
})
}));

Is there any other way to get the dimensions of the captured photo? Thanks.


#2

Remember, What you pass in to takePicture should be device independent pixels and when you get width and height of image it will be in pixels.