[TIMOB-14137] Android: camera returns low resolution image using overlay
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-28T16:06:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 23, 2013 Sprint 23 API, Release 3.2.0 |
Components | Android |
Labels | SupportTeam, regression |
Reporter | Stephane Menard |
Assignee | Pedro Enrique |
Created | 2012-11-26T19:30:33.000+0000 |
Updated | 2014-05-28T16:07:23.000+0000 |
Description
The image returns by the camera is a low res image instead of the full size image on some devices when using an overlay.
The galaxy nexus (4.1) returns an image of 320x240
The ZTE N860 (2.3.5) returns an image of 640x480
Samsung Galaxy S1 (2.3.3) is returning a full size image (2592x1944)
Here is the code sample from bug TIMOB-8151 adapted to display image size.
Ti.UI.setBackgroundColor('#ffffff');
var homeWindow = Titanium.UI.createWindow
({
});
homeWindow.open();
var displayVoucherOverlayView = Ti.UI.createView
({
top: 0,
bottom: 0,
left: 0,
right: 0,
opacity: 0.75
});
var setAButton = Ti.UI.createButton
({
top: 100,
left: 30,
right: 30,
height: 75,
title: "Click here to take a picture"
});
displayVoucherOverlayView.add(setAButton);
setAButton.addEventListener('click', function() { Ti.Media.takePicture(); }
);
var navigationBar = Ti.UI.createView
({
bottom: 0,
height: 50,
right: 0,
backgroundColor: "#000000",
opacity: 0.75
});
var navBarTestBtn = Ti.UI.createView
({
left: 5,
width: 90,
height: 50,
top: 0,
backgroundColor: "#000000",
borderColor: "#FFFFFF",
borderWidth: 2
});
var navBarTestBtnText = Ti.UI.createLabel
({
width: 90,
text: "TEST",
color: "#FFFFFF",
textAlign: 'center',
font: {fontSize: 10}
});
navBarTestBtn.add(navBarTestBtnText);
navigationBar.add(navBarTestBtn);
navBarTestBtn.addEventListener('click', function() {alert("IM A VIEW WITH A LISTENER");} );
displayVoucherOverlayView.add(navigationBar);
var cameraTransform = Ti.UI.create2DMatrix();
cameraTransform = cameraTransform.scale(2);
Ti.Media.showCamera
({
success: function(event) {
Ti.API.info("Image dimension: " + event.media.width + "x" + event.media.height);
alert("Image dimension: " + event.media.width + "x" + event.media.height);
},
cancel: function() {},
error: function(error)
{
if (error.code == Ti.Media.NO_CAMERA)
{
alert("NO CAMERA");
}
else
{
alert("CAMERA ERROR");
}
},
mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO],
showControls: false,
autohide: false,
transform: cameraTransform,
overlay: displayVoucherOverlayView
});
Please format the code or use http://pastie.org. What do you get with event.rect ?
Pedro, I have this issue and have a use case and am willing to work with you on the issue. To answer your question about event rect, here is event.cropRect:
Camera Success Event
Use Case
nexus 4 output using SDK 3.1.1.v20130604110432
overlay used, height:480, width: 640
Any update on this issue? It makes it impossible to have a customized camera-based app on Android, which is currently a very popular style of app. BTW, I'm still seeing this on 3.2.0.v20130614230533.
Titanium SDK version: 3.1.2 (08/06/13 10:45 78d4077) = 3.1.2 RC2 Nexus 4, Android 4.3
overlay used: true - height: 480 width: 640 without overlay: 3264 x 2448
Error still occurs with 3.1.3 Also the e.media.nativePath is null when using an overlay.
here a test with 3.2.0.v20131018154951
overlay used: true - height: 480 width: 640 without overlay: 3264 x 2448
set picturesize to use maximum resolution. Ideally, we should support selection of resolution and should remember the last one used. https://github.com/appcelerator/titanium_mobile/pull/4866
Verified fixed on: Mac OSX 10.9 Mavericks Titanium Studio, build: 3.2.0.201311122029 Titanium SDK, build: 3.2.0.v20131112144044 CLI: 3.2.0 Alloy: 1.3.0 Android Device: Xperia U 2.3.7 Camera successfully takes a picture with a resolution of 2592x1944 Closing.