Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14540

Android: blob.imageAsResize causes java error

    Details

      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

          Issue Links

            Activity

              People

              • Assignee:
                pwang Ping Wang
                Reporter:
                anigam Ashish Nigam
                Reviewer:
                Hieu Pham
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-16981
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code