Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14532] Android: blob.imageAsResized causes java error

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2013-07-22T17:15:03.000+0000
Affected Version/sRelease 3.1.1, Release 3.2.0
Fix Version/sn/a
ComponentsAndroid
LabelsMobile, Titanium, android, mobilesdk
ReporterRaymond de Wit
AssigneeIngo Muschenetz
Created2013-06-24T13:49:38.000+0000
Updated2017-03-20T23:24:39.000+0000

Description

*Problem* When using the imageAsResized function on a blob it causes a java memory error when using a device which has a camera with 6 megapixels or more. I used the code below on the Galaxy S3, and a lot of times it causes an error, sometimes it doesn't. When i set the camera to 3.2 megapixels for example the issue doesn't occur. *Steps to reproduce* 1. Tap Open Camera 2. Take photo 3. Save photo 4. Repeat until Runtime Error appears (see attachment) *Test case*
var win1 = Titanium.UI.createWindow({
	title : 'cameratest',
	backgroundColor : '#fff'
});

var button = Titanium.UI.createButton({
	color : '#999',
	title : 'Open camera'
});

win1.add(button);

button.addEventListener("click", function(e) {
	Ti.Media.showCamera({
		mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
		success : function(e) {
			var width = e.media.width, height = e.media.height, scaleFactor = Math.sqrt((width * height ) / (1600 * 1200 ));

			if (scaleFactor > 1) {
				width /= scaleFactor;
				height /= scaleFactor;

				var image = e.media.imageAsResized(width, height);
			}
		}
	});
});

win1.open();

Attachments

FileDateSize
IMG_0383.jpg2013-06-25T15:13:33.000+00002972751

Comments

  1. Daniel Sefton 2013-06-24

    To help us out, please could you edit your test case to be runnable in an app.js? Also, please attach the error you're getting: logs, or a screenshot.
  2. Daniel Sefton 2013-07-11

    Tested and confirmed on Samsung Galaxy S3 4.0.4 with Ti SDK 3.2 CI (latest).
  3. Vishal Duggal 2013-07-22

    Duplicate of TIMOB-14540
  4. Lee Morris 2017-03-20

    Closing ticket as duplicate.

JSON Source