nativescript-camera icon indicating copy to clipboard operation
nativescript-camera copied to clipboard

Bitmap rotation is very slow on XCover4, add a config option to bypass rotation?

Open SpurguX opened this issue 6 years ago • 0 comments

Which platform(s) does your issue occur on?

  • Android, version 9, API level 28
  • What type of device? Samsung Galaxy XCover 4 (SM-G390F)

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.0.2
  • Cross-platform modules: 6.2.1
  • Runtime(s): 6.0.2
  • Plugin(s):

"dependencies": { "@vue/devtools": "^5.0.6", "axios": "^0.19.0", "date-fns": "^2.7.0", "jsrsasign": "^8.0.12", "nativescript-camera": "^4.5.0", "nativescript-socketio": "^3.2.1", "nativescript-theme-core": "^1.0.6", "nativescript-toasty": "^1.3.0", "nativescript-vue": "^2.4.0", "nativescript-vue-devtools": "^1.2.0", "p-timeout": "^3.2.0", "tns-core-modules": "^6.0.0" }, "devDependencies": { "@babel/core": "^7.0.0", "@babel/preset-env": "^7.0.0", "babel-loader": "^8.0.2", "nativescript-dev-webpack": "^1.0.0", "nativescript-vue-template-compiler": "^2.0.0", "nativescript-worker-loader": "~0.9.0", "node-sass": "^4.9.2", "vue-loader": "^15.4.0" } }

Please, tell us how to recreate the issue in as much detail as possible.

Taking a picture with nativescript-camera takes between 5-10 seconds on average on XCover4 which I found out was because of the call to rotateBitmap. The camera works nice and quick when I comment out the the part where orientation is checked and rotation handled, that is, the following section:

var orientation_1 = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, android.media.ExifInterface.ORIENTATION_NORMAL);
if (orientation_1 === android.media.ExifInterface.ORIENTATION_ROTATE_90) {
  rotateBitmap(picturePath_1, 90);
} else if (orientation_1 === android.media.ExifInterface.ORIENTATION_ROTATE_180) {
  rotateBitmap(picturePath_1, 180);
}
else if (orientation_1 === android.media.ExifInterface.ORIENTATION_ROTATE_270) {
  rotateBitmap(picturePath_1, 270);
}

On Samsung Galaxy S9+ taking a picture is considerably faster but still a bit laggy. I'm wondering if there is something wrong with my project settings or if it's just that XCover4 is not that high performance.

I was thinking that it could be useful to have a config flag called something like bypassRotation that defaults to false or rotateBitmap that defaults to true. The rotation isn't even necessary in my case since the captured image seems to have the correct exif tag set.

SpurguX avatar Nov 18 '19 13:11 SpurguX