[TIMOB-14532] Android: blob.imageAsResized causes java error
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Low | 
| Status | Closed | 
| Resolution | Duplicate | 
| Resolution Date | 2013-07-22T17:15:03.000+0000 | 
| Affected Version/s | Release 3.1.1, Release 3.2.0 | 
| Fix Version/s | n/a | 
| Components | Android | 
| Labels | Mobile, Titanium, android, mobilesdk | 
| Reporter | Raymond de Wit | 
| Assignee | Ingo Muschenetz | 
| Created | 2013-06-24T13:49:38.000+0000 | 
| Updated | 2017-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
| File | Date | Size | 
|---|---|---|
| IMG_0383.jpg | 2013-06-25T15:13:33.000+0000 | 2972751 | 
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.
Tested and confirmed on Samsung Galaxy S3 4.0.4 with Ti SDK 3.2 CI (latest).
Duplicate of TIMOB-14540
Closing ticket as duplicate.